Forum Discussion
Comparing a selected Value from one table to All values in another table.
- 4 years ago
Hi Macks ,
You can try this expression to reach that.
check = IF ( ISBLANK ( SELECTEDVALUE ( Table1[prices] ) ), "Please select one value", IF ( SELECTEDVALUE ( Table2[Thresholds] ) > SELECTEDVALUE ( Table1[prices] ), 1, 0 ) )Result:
Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Macks ,
You can try this expression to reach that.
check =
IF (
ISBLANK ( SELECTEDVALUE ( Table1[prices] ) ),
"Please select one value",
IF (
SELECTEDVALUE ( Table2[Thresholds] ) > SELECTEDVALUE ( Table1[prices] ),
1,
0
)
)
Result:
Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello!
I tried this using a calculated column, I had to use Related on table2(thresholds), if i dont, it says: expressions that yield variant data type cannot be used to define calculated columns
So when i use Related,
It states that my Threshold table doesnt exist or doesnt have a relationship to any table availabe in the current context. My current relation from thresholds to price is one to many (one threshold relates to many prices).
Also as a quick side note, i searched SELECTEDVALUE here: SELECTEDVALUE function - DAX | Microsoft Docs, and it says
This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules
Is there a work around for all this?
sorry for all the questions!
- v-chenwuz-msft4 years agoCommunity Support
Hi Macks ,
If you use a calculated column, then there is no way to select threshold. selectedvalue does not make sense when used in a calculated column. Actions at the report level are not fed back to the data table.
A workround for selectedvalue() is max(). MAX() is supported for use in DirectQuery.
Please share that your pbix file does not contain sensitive information. and the expected results. I apologise as I am not entirely understanding why you need to use related?
Best Regards
Community Support Team _ chenwu zhu
- Macks4 years agoFrequent Visitor
My apologies! i couldnt open the file for some reason so i assumed you created a calculated column but once i was able to open the pbi i realized you made a measure! I marked it as the accepted solution, thank you so much for the help!