The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi all,
I'm new to PBI and struggling to understand why this if statement isn't working.
I want to check whether the selected filter value is present in another table (linked via a separate key).
In this example, the value ID 87308 is selected by a page filter, and appears in this table using the SELECTED VALUE function in column "sel". I want to compare sel to Node1, but for some reason the if statements I've tried in columns "matched" and "M2" don't recognise that two values are the same. The Sel field is a measure (I think it has to be given that I'm using the selectedvalue function), and the Node1 field is a calculated column.
Any tips on how to get this to work?
Matched = if([sel]=[Node1], "Y", "N") only returns N values
The two strings are identical, there isn't any whitespace.
Many thanks!
Solved! Go to Solution.
Thanks for the replies from Chetan007 and HotChilli.
Hi @ndj2212 ,
As HotChilli says, because calculated column are pre-calculated and stored, they do not react to dynamic changes in page filters or slicers. Calculated column remain the same no matter how you filter the data in your report.
So you should create a measure instead of a calculated column, for example:
Measure = IF(MAX([Node1])=[sel],"Y","N")
Result:
Best Regards,
Zhu
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for the replies from Chetan007 and HotChilli.
Hi @ndj2212 ,
As HotChilli says, because calculated column are pre-calculated and stored, they do not react to dynamic changes in page filters or slicers. Calculated column remain the same no matter how you filter the data in your report.
So you should create a measure instead of a calculated column, for example:
Measure = IF(MAX([Node1])=[sel],"Y","N")
Result:
Best Regards,
Zhu
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This happens a lot. Calculated columns do not respond to slicers/filters.
'Matched' is a column or a measure?
matched is a column. I just need a text row-level column that is Y if the Node1 column matches the selected value ("sel")
Hii
Thanks for your help, unfortunately that doesn't make a difference