Reputation: 243
I have created a few reports using Power BI and Direct Query. All the visuals have used the standard filters in the Power BI tab.
Now I would like to create a report with a large table or matrix containing many rows and columns. Some of these columns are measures which are filtered on other fields. For example, one column will be an amount where a field is equal to "A" and the next column will be an amount where a field is equal to "B". They will both be using the same measure.
How can this be done? If I use the field in the standard filter tab then the entire table will have that filter. Can I create a calculated measure to do the job?
Upvotes: 1
Views: 22849
Reputation: 243
I managed to solve this by using the following DAX:
New measure = CALCULATE(
[measure_name],
FILTER(Table_name, Table_name[field_name]="Value A (or Value B)")
)
The SELECTEDVALUE DAX function seems to give the same result as well.
Upvotes: 0
Reputation: 129
Yes it can be done using the SELECTEDVALUE DAX function in your measures.
I created a small sample PBIX file demonstrating this technique, and you can download it at:
[demo file]
Upvotes: 1