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 want to calculate the percentage of revenue for the picked year/years AND month/months that the user have picked, My DAX formula is the following:
Revenue = IF (
SELECTEDVALUE ('Month'[Month]) > 1;
CALCULATE (
SUM ( MFE_RR_Generell_VerTrans[Revenue] );
FILTER ( ALL ( MFE_RR_Generell_VerTrans ); MFE_RR_Generell_VerTrans[RRKontoGruppID] = 101 && MFE_RR_Generell_VerTrans[DateMonth] = 'Month' && MFE_RR_Generell_VerTrans[DateYear] = SELECTEDVALUE ('Year'[Year]))
)
)
I know that this solution is not the correct one, but I dont know what else to try, this one (for obvious reasons) only works when you have picked ONE year AND one month. When i select multiple months the revenue wont calculate at all.
Solved! Go to Solution.
I had to modify my solution in order to get it to work even if none where selected, know I could have used ALLEXCEPT, but this works fine. Here is the full code:
HI @dkarl403,
AFAIK, selectedvalue function not support deal with multiple selection(it will return blank if select multiple items), please use allselected or values with countrows function to instead.
Sample:
Revenue = IF ( COUNTROWS ( ALLSELECTED ( 'Month'[Month] ) ) > 1; CALCULATE ( SUM ( MFE_RR_Generell_VerTrans[Revenue] ); FILTER ( ALL ( MFE_RR_Generell_VerTrans ); MFE_RR_Generell_VerTrans[RRKontoGruppID] = 101 && MFE_RR_Generell_VerTrans[DateMonth] IN ALLSELECTED ( 'Month'[Month] ) && MFE_RR_Generell_VerTrans[DateYear] IN ALLSELECTED ( 'Year'[Year] ) ) ) )
Regards,
Xiaoxin Sheng
I had to modify my solution in order to get it to work even if none where selected, know I could have used ALLEXCEPT, but this works fine. Here is the full code:
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 |
---|---|
100 | |
99 | |
80 | |
77 | |
66 |
User | Count |
---|---|
134 | |
106 | |
104 | |
85 | |
73 |