Search code examples
powerbidax

Only show rows with values in Power BI


EDIT: The solution below worked because the DAX was checking the "First" value out of multiple items in each group, which may be null even though another row in the group has a value. By looking at the MAX value, it can be determined if there is any value among all items in the group.

I am using this DAX to determine if a row is empty in a matrix. The results are inconsistent however. I'm checking for length and ISBLANK. What is a more effective what to determine if a row is empty?

ShowRow = 
IF(
    (ISBLANK(SELECTEDVALUE(VP2Fabric___Project_Progress[detail_curHrs])) || LEN(TRIM(SELECTEDVALUE(VP2Fabric___Project_Progress[detail_curHrs]))) = 0) &&
    (ISBLANK(SELECTEDVALUE(VP2Fabric___Project_Progress[detail_curAmt])) || LEN(TRIM(SELECTEDVALUE(VP2Fabric___Project_Progress[detail_curAmt]))) = 0) &&
    (ISBLANK(SELECTEDVALUE(VP2Fabric___Project_Progress[detail_Comments2])) || LEN(TRIM(SELECTEDVALUE(VP2Fabric___Project_Progress[detail_Comments2]))) = 0)
,
"Empty",
"NOT Empty"
)

enter image description here


Solution

  • maybe you can try this

    ShowRow = 
    IF(
        (ISBLANK(MAX(VP2Fabric___Project_Progress[detail_curHrs])) || LEN(TRIM(MAX(VP2Fabric___Project_Progress[detail_curHrs]))) = 0) &&
        (ISBLANK(MAX(VP2Fabric___Project_Progress[detail_curAmt])) || LEN(TRIM(MAX(VP2Fabric___Project_Progress[detail_curAmt]))) = 0) &&
        (ISBLANK(MAX(VP2Fabric___Project_Progress[detail_Comments2])) || LEN(TRIM(MAX(VP2Fabric___Project_Progress[detail_Comments2]))) = 0)
    ,
    "Empty",
    "NOT Empty"
    )