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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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!:
Mastering Power BI 2nd Edition

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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