Forum Discussion
Design issue
Hello All
I have few measures for New subscriptions and Total subscriptions. when I put it in the table I get output like
| New subscriptions YTD | New subscriptions Same period last yr | New subscriptions Varience% | Total subscriptions YTD | Total subscriptions Same period last yr | Total subscriptions varience % |
But actually I want to format table to show like this:
| YTD | Same period last yr | Varience % | |
| New subscriptions | |||
| Total subscriptions |
How do I do that?
BR,
PP
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.
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:
12 Replies
- PaulDBrownCommunity Champion
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:
- SykResident Rockstar
Use the matrix visual instead of the table. Put your subscribtions in the row spot and YTD, variance in the column spot
- SykResident Rockstar
How do you determine a new sub?
I'd suggest having 2 base measures "New subscriptions" and "Total Subscriptions"
Then you can find the YTD/variance/whatever else from these and use them in a matrix for example- SykResident Rockstar
Try putting your date field (sounds like you want year) in the row section and your measures in the value
- v-zhangtiCommunity Support
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.