Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
PBIDEV_10
Helper II
Helper II

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 YTDNew subscriptions Same period last yrNew subscriptions Varience%Total subscriptions YTDTotal subscriptions Same period last yrTotal subscriptions varience %
      

 

But actually I want to format table to show like this:

 YTDSame period last yrVarience %
New subscriptions   
Total subscriptions   

 

How do I do that? 

 

BR,

PP

2 ACCEPTED SOLUTIONS
v-zhangti
Community Support
Community 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

vzhangti_0-1640673182776.png

Use First Row as Headers

vzhangti_1-1640673210206.jpeg

Add Index Column

vzhangti_2-1640673703750.jpeg

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])

vzhangti_3-1640673845016.png

vzhangti_5-1640674350111.png

 

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.

View solution in original post

PaulDBrown
Community Champion
Community 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"):

Matrix layout.jpg

 

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:

result.jpgAnimation.gif

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

12 REPLIES 12
PaulDBrown
Community Champion
Community 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"):

Matrix layout.jpg

 

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:

result.jpgAnimation.gif

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






v-zhangti
Community Support
Community 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

vzhangti_0-1640673182776.png

Use First Row as Headers

vzhangti_1-1640673210206.jpeg

Add Index Column

vzhangti_2-1640673703750.jpeg

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])

vzhangti_3-1640673845016.png

vzhangti_5-1640674350111.png

 

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.

Syk
Super User
Super User

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

@Syk Yes I have two base measures as new subscriptions and Total subscriptions. And calculating Ytd etc is not an issue. The problem is when I am using matrix visual, as per its def, it is not possible to add a measure in row or column. So how I can produce the desired output?

Try putting your date field (sounds like you want year) in the row section and your measures in the value

Yes. But to calculate YTD I have to use the formula DATESYTD(Calendar[Date]) which is nothing but a measure. 

Dont use the measure but the actual date field

But I dont want to show date in rows. May I ask if you can put your suggestions in a pbix file if possible? Since I am not able to understand fully how the desired output can be achieved with your suggestions.

Something similar to this..

Syk_0-1640191392735.png

 

@Syk But then New and Total subscription measures will be like one after another and not one below another.

Syk
Super User
Super User

Use the matrix visual instead of the table. Put your subscribtions in the row spot and YTD, variance in the column spot

@Syk Itried to use matrix but it didnt help. Can you explain bit more about it?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.