Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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:
User | Count |
---|---|
98 | |
90 | |
82 | |
73 | |
67 |
User | Count |
---|---|
115 | |
102 | |
98 | |
71 | |
67 |