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
PBI-V_Curious
Regular Visitor

How to combine two dax measures into one in a matrix view

Hello PBI Community 
Good Day!

 

Sample .pbix

Power BI Sample Data.pbix

 

 

Per the screen shots from my sample .pbix below, I have created a view with Sales and Revenue in a matrix visual with ease. However, when I use Analyze in Excel to create the same view, I can’t use the SnR Amount, I have to use my ( Total Sales and Total Revenue) Key measures I have created.

Screen Shot1

PBIV_Curious_0-1711725503662.png

What I’m trying to accomplish:

To create the same view per my .pbix above in Analyze in Excel.

What I have accomplished so far.

I have been able to create a similar view in Analyze in Excel, but my Sales and Revenue are staggered.- Screen Shot 2

I need help with creating one measure that combines both measures to give me the view I have in Screen Shot 1 ( Sales and Revenue stacked and align under each other).

Screen Shot 2

PBIV_Curious_1-1711725550622.png

Here are my measure from my sample dataset.

Total Revenue = CALCULATE(SUM(‘SnR 2020 - 2022’[SnR Amount]),‘SnR 2020 - 2022’[transaction_type] = “Revenue”)

Total Sales = CALCULATE(SUM(‘SnR 2020 - 2022’[SnR Amount]),‘SnR 2020 - 2022’[transaction_type] = “Sales” || ‘SnR 2020 - 2022’[transaction_type] = “Timing” )

 

Please advise if you have any questions.

Much appreciate your time and support per this matter.

Thank you

 

Attachment:

Sample .pbix

 

3 ACCEPTED SOLUTIONS
tamerj1
Super User
Super User

Hi @PBI-V_Curious 

have you tried:

Total Amount = [Total Sales] + [Total Revenue]

?

View solution in original post

rachaelwalker
Resolver III
Resolver III

 

SWITCH Statement = 
VAR SnRSelected = SELECTEDVALUE(SnR[SnR ])

RETURN
IF(
    ISBLANK(SnRSelected), 
    BLANK(),
    SWITCH(
        TRUE(),
        SnRSelected = "Revenue", [Total Revenue],
        SnRSelected = "Sales", [Total Sales]
    )
)

 

View solution in original post

Tamerj1

Success, much appreciate your help!

Thank you

View solution in original post

7 REPLIES 7
rachaelwalker
Resolver III
Resolver III

 

SWITCH Statement = 
VAR SnRSelected = SELECTEDVALUE(SnR[SnR ])

RETURN
IF(
    ISBLANK(SnRSelected), 
    BLANK(),
    SWITCH(
        TRUE(),
        SnRSelected = "Revenue", [Total Revenue],
        SnRSelected = "Sales", [Total Sales]
    )
)

 

rachaelwalker

Success, much appreciate your help!

Thank you

Hello Rachael

Love the switch statement, will give it a try.

Much appreciate your quick response

Thank you

tamerj1
Super User
Super User

Hi @PBI-V_Curious 

have you tried:

Total Amount = [Total Sales] + [Total Revenue]

?

Tamerj1

Success, much appreciate your help!

Thank you

Hello tamerj1

Not yet, will give it a try!

Much appreciate your quick response

Thank you

I like your simple solution. My proposed solution was more complicated than needed.

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.