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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Unpivot Column with Different Calculation Applied

Hi there,

 

I am trying to unpivot data matrix using pwoer query but the data calculation is not only using summraize but also average since the value have different value format, iie. absolute number and percentage. Is it possible to apply this purpose using unpivot column in power query?

 

Here is the data matrix example:

JuliusSugi_0-1680584690077.png

I would like to convert (unpivot) and visualize the table into this:

JuliusSugi_1-1680584857868.png

Kindly share your thoughts on this. 

 

Thank you in advance!

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 
Please try

Total Target (Switch) =
IF (
    CONTAINSSTRING ( MAX ( 'Table'[Indicator] ), "%" ),
    AVERAGEX ( VALUES ( 'Date'[YearMonth] ), [Total Target] ),
    SUMX ( VALUES ( 'Date'[YearMonth] ), [Total Target] )
)

Same for total actual

View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @Anonymous 
Please try

Total Target (Switch) =
IF (
    CONTAINSSTRING ( MAX ( 'Table'[Indicator] ), "%" ),
    AVERAGEX ( VALUES ( 'Date'[YearMonth] ), [Total Target] ),
    SUMX ( VALUES ( 'Date'[YearMonth] ), [Total Target] )
)

Same for total actual

amitchandak
Super User
Super User

@Anonymous , I am assuming the first one is the source

 

How to Deal with Double Headers in Power BI | Free Power BI Tutorials: https://youtu.be/1e16oHv9kTk

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

Hi Amit, 

Thanks for sharing your thought. However the steps is still not achieve what I need to perform different calculation type per-each category/indicator As you may see in the scond table. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.