Forum Discussion
cheryl0316
Helper II
1 year agoDynamic columns/measures in matrix
I’d really appreciate any help with this. I’ve created a sample dataset and would like to build a matrix as follows: When the user selects 2024 and 2023: "Last Week" group should...
- 1 year ago
Hi cheryl0316
Ensure that you have a separate date dimensions table. Creat the following measures
Current Year = VAR _Year = CALCULATE ( MAX ( Dates[Year] ), ALLSELECTED ( Dates ) ) RETURN CALCULATE ( SUM ( 'Table'[Revenue] ), KEEPFILTERS ( Dates[Year] = _Year ) ) Previous Year = VAR _Year = CALCULATE ( MIN ( Dates[Year] ), ALLSELECTED ( Dates ) ) RETURN CALCULATE ( SUM ( 'Table'[Revenue] ), KEEPFILTERS ( Dates[Year] = _Year ) ) Difference = [Current Year] - [Previous Year]Create these calculation items
Last Week = CALCULATE( SELECTEDMEASURE(), FILTER( ALL('Table'[Week No]), 'Table'[Week No] = 52 ) ) --NOTE: no 53 in your sample data for 2023 and 2024 Last Month = CALCULATE( SELECTEDMEASURE(), FILTER( ALL ( 'Dates' ), Dates[Month Number] = 12 ) ) Last Quarter = CALCULATE( SELECTEDMEASURE(), FILTER( ALL(Dates), Dates[Quarter] = 4 ) )
v-venuppu
Community Support
1 year agoHi cheryl0316 ,
Thank you DataNinja777 danextian for the Prompt Response.
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.