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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Display One or more calculated columns under single column/heading in matrix layout

Hi Community,

I want to display One or more calculated columns under single column/heading in a matrix layout. I can do it easily for non calculated columns by unpivoting in 'Transform data' section, but calculated columns dont appear in transform data section.

Current display:

 

Capture1.PNG

 

 

 

 

Expected display:

 

Capture2.PNG

Many thanks in advance!

 

 

1 ACCEPTED SOLUTION
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try this solution.

1. Export data (Don't aggregate data)

v-lionel-msft_0-1599642272541.png

2. Unpivot the WaitTime1~5 columns in Edit Query.

3. Create a calculated column with DAX.

 

Column = 
SWITCH(
    [Attribute],
    "WaitTime1", "Stage1",
    "WaitTime2", "Stage1",
    "WaitTime3", "Stage2",
    "WaitTime4", "Stage2",
    "WaitTime5", "Stage3"
)

v-lionel-msft_0-1599642489653.png

 

4. Create a matrix visual.

v-lionel-msft_1-1599642429745.png

 

Best regards,
Lionel Chen

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

6 REPLIES 6
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try this solution.

1. Export data (Don't aggregate data)

v-lionel-msft_0-1599642272541.png

2. Unpivot the WaitTime1~5 columns in Edit Query.

3. Create a calculated column with DAX.

 

Column = 
SWITCH(
    [Attribute],
    "WaitTime1", "Stage1",
    "WaitTime2", "Stage1",
    "WaitTime3", "Stage2",
    "WaitTime4", "Stage2",
    "WaitTime5", "Stage3"
)

v-lionel-msft_0-1599642489653.png

 

4. Create a matrix visual.

v-lionel-msft_1-1599642429745.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Greg_Deckler
Super User
Super User

@Anonymous - If I understand this correctly, you could do this with a custom matrix hierarchy: https://community.powerbi.com/t5/Quick-Measures-Gallery/The-New-Hotness-Custom-Matrix-Hierarchy/m-p/963588#M428


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@Anonymous , first Unpivot and then create stage on as new calculated column

https://radacad.com/pivot-and-unpivot-with-power-bi
Transpose : https://yodalearning.com/tutorials/power-query-helps-transposing-data/

 

New Column = Switch(True() ,

[waittime] in {"waittime1","waittime2"} , "Stage1",

[waittime] in {"waittime3","waittime4"} , "Stage2",

"Stage3"

)

 

Display in matrix with two columns waittime and stage

Anonymous
Not applicable

@amitchandak  how can I unpivot calculated columns? They dont appear in transform data section.

Anonymous
Not applicable

@amitchandak any suggestions?

Hi @Anonymous ,

 

Do you mind sharing your .pbix file?

Or show the sample data of the fact table and the formulas of the calculated columns. The information is necessary for us.

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.