Forum Discussion
Design issue
- 4 years ago
Hi, PBIDEV_10
You can refer to my method to see if you can achieve the results you expect.
Check Transpose in the power query
Use First Row as Headers
Add Index Column
Add calculated columns in Desktop, and rename 2020 and 2021.
Column = IF([Index]=1,"New subscriptions","Total subscriptions")Varience % = DIVIDE([YTD]-[Same period last yr],[YTD])Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- 4 years ago
Here is one way.
1) create an independent table using the enter data in the ribbon and type in the values you need for the rows in the matrix and an index column. In my example (I.ve named the table "Matrix Layout"):
2) I'm comparing sales for A vs total sales, so I'm using these base measures (adjust according to what you need:
Sum Sales = SUM(FactTable[Forecast])Sales for A = CALCULATE([Sum Sales],'Dim Channel'[Channel] = "A")3) for the matrix, create the measures for each of the columns using the equivalent to the following logic( the relevant code is the SWITCH function; the detail is up to what you need):
YTD = SWITCH ( SELECTEDVALUE ( 'Matrix layout'[Index] ), 1, [Sales for A], [Sum Sales] )Last Year = SWITCH ( SELECTEDVALUE ( 'Matrix layout'[Index] ), 1, CALCULATE ( [Sales for A], PREVIOUSYEAR ( 'Date Table'[Date] ) ), CALCULATE ( [Sum Sales], PREVIOUSYEAR ( 'Date Table'[Date] ) ) )Variance = VAR PYA = CALCULATE ( [Sales for A], PREVIOUSYEAR ( 'Date Table'[Date] ) ) VAR PYS = CALCULATE ( [Sum Sales], PREVIOUSYEAR ( 'Date Table'[Date] ) ) RETURN SWITCH ( SELECTEDVALUE ( 'Matrix layout'[Index] ), 1, [Sales for A] - PYA, [Sum Sales] - PYS )4) Create the matrix using the matrix layout column as rows and add the measures as values to get: