Forum Discussion
How to achieve Filter Logic based on two columns using DAX
- Anonymous4 years ago
Hi apatwal ,
I created some data:
From the data, [Profit % 2020] of CustomerA is greater than [Profit % 2021], and [Profit % 2020] of CustomerB is less than [Profit % 2021]
Here are the steps you can follow:
1. Create measure.
Flag =
IF( MAX('Table'[Profit % 2020])>MAX('Table'[Profit % 2021]),1,0)AllRevenue = SUMX(ALLSELECTED('Table'),[Revenue])The results have not been filtered
2. Place [Flag]in Filters, set is=1, apply filter.
3. Result:
After setting [Flag] to 1, according to condition 2, the data of CustomerB is deleted, leaving the data of CustomerA, and the value of [AllRevenue] will also calculate the filtered data
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi apatwal ,
I created some data:
From the data, [Profit % 2020] of CustomerA is greater than [Profit % 2021], and [Profit % 2020] of CustomerB is less than [Profit % 2021]
Here are the steps you can follow:
1. Create measure.
Flag =
IF(
MAX('Table'[Profit % 2020])>MAX('Table'[Profit % 2021]),1,0)AllRevenue =
SUMX(ALLSELECTED('Table'),[Revenue])
The results have not been filtered
2. Place [Flag]in Filters, set is=1, apply filter.
3. Result:
After setting [Flag] to 1, according to condition 2, the data of CustomerB is deleted, leaving the data of CustomerA, and the value of [AllRevenue] will also calculate the filtered data
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly