Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

DAX for comparing data

Hi there,   I have data in below mentioned format:   Product Profit Year A 53.28% 2014 B 46.57% 2014 C 42.35% 2014 D 63.32% 2014 E 64.43% 2014 F 22.92% 2014 ...
  • Anonymous's avatar
    Anonymous
    7 years ago

    Anonymous  - 

    One way you can accomplish this would be to add a Calculated Column to make groupings of your  Categories:

    Parent Category = 
    IF(
        [Category] = "A",
        "A",
        "Other"
    )

    And then use the new Calculated Column as the Legend on your line chart, along with a simple Average as your value.

    Otherwise, you could create 2 separate measures and add them both to your line chart:

    Average Profit (A) = 
    CALCULATE(
        AVERAGE(YourTable[Profit]),
        YourTable[Category] = "A"
    )
    Average Profit (Not A) = 
    CALCULATE(
        AVERAGE(YourTable[Profit]),
        YourTable[Category] <> "A"
    )
    I hope this helps. If it does, please Mark as a solution.
    I also appreciate Kudos.
    Nathan Peterson