Forum Discussion

LarsAustin's avatar
LarsAustin
Helper I
5 years ago
Solved

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.

 

 

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

  • Anonymous's avatar
    Anonymous
    5 years ago

    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 )
            )
        )


    Regards,
    Xiaoxin Sheng

4 Replies

      • Anonymous's avatar
        Anonymous
        Not applicable

        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 )
                )
            )


        Regards,
        Xiaoxin Sheng