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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
LarsAustin
Helper I
Helper I

Power BI - Get Data from Another Measure

Hi All,

 

I have an issue with my measure in Power BI. I created the measure below:

 

Retail Margin = [Retail Value]*0.4 

 

The Retail Value measure is written as:

 

Retail Value = SUMX(RetailValue,RetailValue[Market Size]*RetailValue[Musashi Market Share])

 

I am getting the correct answer but the problem is when i put it in a matrix opposite the header Retail Margin, it is not coming up. Instead, it is showing opposite the Retail Value header. I am sure this has something to do with the context but I cannot just figure how to make it work. My end goal is to have the yellow value to be showing in the blue field.

 

LarsAustin_0-1615441289021.png

 

I wanted to attach the pbix file but I can't. Not sure how to do it or if it is even possible.

 

I will really any feedback that will point me to the right direction in solving this.

 

Thanks

 

LarsAustin

1 ACCEPTED SOLUTION

HI @LarsAustin,

You can try to use the following measure expressions to replace raw measure formulas:

Retail Margin =
VAR currHeader =
    SELECTEDVALUE ( Header1[Header Account] )
VAR headerID =
    CALCULATETABLE (
        VALUES ( Header1[Header ID] ),
        FILTER ( ALL ( Header1 ), [Header Account] = "Retail Value" )
    )
VAR accountID =
    CALCULATETABLE (
        VALUES ( AccountMaster[Account ID] ),
        FILTER ( ALLSELECTED ( AccountMaster ), [Header ID] IN headerID )
    )
RETURN
    IF (
        currHeader = "(-) Retail Margin Assumption"
            || currHeader = BLANK (),
        CALCULATE (
            [Retail Value] * .4,
            FILTER ( ALLSELECTED ( RetailValue ), [Account ID] IN accountID )
        )
    )

17.png
Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@LarsAustin , can you upload the pbix on dropbox or onedrive and share the link

Hi Amit,

 

Link below:

 

https://www.dropbox.com/s/ztoidgecgrs1r4j/Sample.pbix?dl=0

 

Thanks

 

LarsAustin

HI @LarsAustin,

You can try to use the following measure expressions to replace raw measure formulas:

Retail Margin =
VAR currHeader =
    SELECTEDVALUE ( Header1[Header Account] )
VAR headerID =
    CALCULATETABLE (
        VALUES ( Header1[Header ID] ),
        FILTER ( ALL ( Header1 ), [Header Account] = "Retail Value" )
    )
VAR accountID =
    CALCULATETABLE (
        VALUES ( AccountMaster[Account ID] ),
        FILTER ( ALLSELECTED ( AccountMaster ), [Header ID] IN headerID )
    )
RETURN
    IF (
        currHeader = "(-) Retail Margin Assumption"
            || currHeader = BLANK (),
        CALCULATE (
            [Retail Value] * .4,
            FILTER ( ALLSELECTED ( RetailValue ), [Account ID] IN accountID )
        )
    )

17.png
Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thank you so much. Works perfectly!

 

Cheers

 

LarsAustin

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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