Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hello, i want to create a simple flag like this:
IF (TRIM(SELECTEDVALUE(X[xxx])) <> BLANK() && TRIM(SELECTEDVALUE(X[xxx])) <> "" && TRIM(SELECTEDVALUE(X[xxx])) <> "N/A (abc)",1 , 0)
As you can see, IF is not optimized, because i'm trying to see what's happening. I've removed the variables, added trim, and even considered ""
On a report page with some visuals, this IF "column" is returning wrong values, like :
But if i copy this same table to a new page, it works:
So, what's happening? Could it be any problem with my model?
Regards
Solved! Go to Solution.
HI @Ricardo77,
Did you work with the calculated column? If that is the case, they don't respond with the filter and slicers effect so the selectedvalue function may not work properly. (calculate column and filter are work on different data levels, you can use child level to affect its parent)
SELECTEDVALUE function - DAX | Microsoft Docs
I'd like to suggest you direct use the Table[Column Name] to invoke the current row content and compare it with the if statement conditions:
Flag =
IF ( TRIM ( X[xxx] ) IN { BLANK (), "", "N/A (abc)" }, 0, 1 )
Notice: the data level of power bi.
Database(external) -> query table(query, custom function, query parameters) -> data model table(table, calculate column/table) -> data view with virtual tables(measure, visual, filter, slicer)
Regards,
Xiaoxin Sheng
HI @Ricardo77,
Did you work with the calculated column? If that is the case, they don't respond with the filter and slicers effect so the selectedvalue function may not work properly. (calculate column and filter are work on different data levels, you can use child level to affect its parent)
SELECTEDVALUE function - DAX | Microsoft Docs
I'd like to suggest you direct use the Table[Column Name] to invoke the current row content and compare it with the if statement conditions:
Flag =
IF ( TRIM ( X[xxx] ) IN { BLANK (), "", "N/A (abc)" }, 0, 1 )
Notice: the data level of power bi.
Database(external) -> query table(query, custom function, query parameters) -> data model table(table, calculate column/table) -> data view with virtual tables(measure, visual, filter, slicer)
Regards,
Xiaoxin Sheng
Hello @amitchandak , thanks for the tip, again it fails on the report page with other visuals, and it's ok in the empty one.
I've found meanwhile that it is something related to the date table, and i believe it should be related to bad dimensional modelling - but open to other ideas 🙂
@Ricardo77 , hope there is no filter, drill through the filter, slicer filter etc
Also, try like
IF ( not isblank(TRIM(SELECTEDVALUE(X[xxx]))) && TRIM(SELECTEDVALUE(X[xxx])) <> "" && TRIM(SELECTEDVALUE(X[xxx])) <> "N/A (abc)",1 , 0)
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 42 | |
| 35 | |
| 35 | |
| 21 | |
| 15 |
| User | Count |
|---|---|
| 65 | |
| 58 | |
| 28 | |
| 27 | |
| 25 |