Forum Discussion
Irregular Quarter Comparison
- 5 years ago
Hi Anonymous,
I'm not clear about the red mark:
When Q1 and Q2 selected, why aren't the places marked in red returning null values?
Try measure as:
CQ = var quar= MAXX( ALLSELECTED('Table'[Quarter]), 'Table'[Quarter]) return MAXX( FILTER( ALL('Table'), 'Table'[Quarter]=quar && 'Table'[Company]=MAX('Table'[Company]) && 'Table'[Deptt]=MAX('Table'[Deptt]) ), 'Table'[Value] )PQ = var _tab= SUMMARIZE( ALLSELECTED('Table'), 'Table'[Index], 'Table'[Quarter], 'Table'[Value], 'Table'[Company], 'Table'[Deptt] ) return MAXX( FILTER( _tab, [Index] < MAX('Table'[Index]) && 'Table'[Company]=MAX('Table'[Company]) && 'Table'[Deptt]=MAX('Table'[Deptt]) ), [Value] )Here is the output:
If you still have some question, please don't hesitate to let me known.
Best Regards,
Link
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!
Hi Anonymous,
Could you provide your sample data and expected output?
Best Regards,
Link
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!
Company Deptt. Quarter Salary
ABC Sales 2020Q1 10000
ABC Sales 2020Q2 20000
ABC Marketing 2020Q1 20000
ABC Marketing 2020q3 50000
DEF Accounts 2020q1 400000
DEF Accounts 2020q2 400000
Final results should be when Q3 & q1 is selected
ABC Sales null 10000
ABC Marketing 50000 20000
DEF Accounts 400000 null
- v-xulin-mstf5 years agoCommunity Support
Hi Anonymous,
I'm not clear about the red mark:
When Q1 and Q2 selected, why aren't the places marked in red returning null values?
Try measure as:
CQ = var quar= MAXX( ALLSELECTED('Table'[Quarter]), 'Table'[Quarter]) return MAXX( FILTER( ALL('Table'), 'Table'[Quarter]=quar && 'Table'[Company]=MAX('Table'[Company]) && 'Table'[Deptt]=MAX('Table'[Deptt]) ), 'Table'[Value] )PQ = var _tab= SUMMARIZE( ALLSELECTED('Table'), 'Table'[Index], 'Table'[Quarter], 'Table'[Value], 'Table'[Company], 'Table'[Deptt] ) return MAXX( FILTER( _tab, [Index] < MAX('Table'[Index]) && 'Table'[Company]=MAX('Table'[Company]) && 'Table'[Deptt]=MAX('Table'[Deptt]) ), [Value] )Here is the output:
If you still have some question, please don't hesitate to let me known.
Best Regards,
Link
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!
- Anonymous5 years agoNot applicable
Perfect, it worked!