Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a column Major and I have another calculation called Filter Condition that checks to see if two of the slicers have checked before showing the values on the chart. I would like to use DAX to return the Major when the Filter Condition = "Yes" otherwise return a blank string. For example:
Value = If([Filter Condition]="Yes", myTable[Major], "")
But DAX does not allow me to use myTable[Major] in there and I can only return a measure or calculation. How else I can acheive the same result?
Solved! Go to Solution.
You may just add MAX.
MAX ( myTable[Major] )
You may just add MAX.
MAX ( myTable[Major] )
Hi @arashaga
Is Value a measure? If so, you cannot use a naked column like myTable[Major] directly because there is no row context and therefore DAX does not know what value in myTable[Major] to choose.
Maybe if you place myTable[Major] in the rows of a matrix visual and use [Filter Condition] as a visual level filter, showing the items with value Yes you'll get what you want? (I'm not sure I've completely understood your requirement).
Thanks @AlB, I think all I need is to know how to return a value of a colum row by row within an if condition. Is there anyway we could do this. As an exmaple(pseudo code):
If ( condition is met, myTable[Major], "")
Your initial code should be fine for that, if you are using it in a calculated column of myTable and everything in your code refers to myTable.
@AlB I get an error int he original formula asking to use aggregation such as max, min, etc.... I was wondering if there is a way to return the string value of that column.
Ok. I still don't know if Value is a column or a measure, what tables you have... Maybe if you share your pbix we'd be quicker
If it asks for an aggregation that means there's no row context where you are trying this
The value I am trying to return is a column containing string values. It is not a measure. I know with measures the formula would work. Thanks again.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |