Forum Discussion

ttcalendar's avatar
ttcalendar
Frequent Visitor
6 years ago

DAX Measure If Row header is then

Hi,

 

I have a matrix table where there are 4 row headers for a P&L report. I've been looking for a measure where it would calculate "Global Var% of LY" based on the table maxtrix row name. 

The current measure is [Global Total Value LY]-[Global Total Value TY])/[Global Total Value LY].

I'm looking for something that will say IF Row name = TOTAL NEW SALES then

[Global Total Value TY]-[Global Total Value LY])/[Global Total Value TY] otherwise for the other headers COST OF SALES, DIRECT EXPENSES AND OVERHEADS return [Global Total Value LY]-[Global Total Value TY])/[Global Total Value LY].
 
Essentially I need a different calculation to occur for the row name TOTAL NEW SALES.
 
Is this possible?

 

7 Replies

  • az38's avatar
    az38
    Icon for Community Champion rankCommunity Champion

    Hi ttcalendar 

    If i understand you correct in the most common case you can try a measure like

    = IF(MAX('Table'[Row level1]) = 'TOTAL NEW SALES', [Global Total Value TY]-[Global Total Value LY])/[Global Total Value TY], [Global Total Value LY]-[Global Total Value TY])/[Global Total Value LY])
  • v-xicai's avatar
    v-xicai
    Icon for Community Support rankCommunity Support

    Hi  ttcalendar  ,

     

    Does that make sense? If so, kindly mark the proper reply as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.

     

    Best regards

    Amy

  • VijayP's avatar
    VijayP
    Icon for Community Champion rankCommunity Champion

    ttcalendar 

    "[Global Total Value TY]-[Global Total Value LY])/[Global Total Value TY] otherwise for COST OF SALES, DIRECT EXPENSES AND OVERHEADS return [Global Total Value LY]-[Global Total Value TY])/[Global Total Value LY]." 

     

    The above statemet is bit confusing. just rephrase it so that I can help. I work PNL in Power bI

    • ttcalendar's avatar
      ttcalendar
      Frequent Visitor

      Apologise if this wasn't clear, I have amended my post.

      • az38's avatar
        az38
        Icon for Community Champion rankCommunity Champion

        ttcalendar 

        how should look like value in row  TOTAL NEW SALES - Sales?

  • Anonymous's avatar
    Anonymous
    Not applicable

    I am encountering the same problem. Has anyone figured this out yet?