Forum Discussion

Gjakova's avatar
Gjakova
Post Patron
6 years ago
Solved

How to split two values inside one column into two different measures?

Does someone know how I can split a measure just using DAX? I have a measure from my database with two values (value A and B), I want to create two seperate measures from that single measure. Measue A and Measure B, does someone know how to do this in DAX?

Example: measure X contains the values ABC and XYZ
I want to calculate the revenue for value ABC and XYZ and then also calculate the difference between them. Therefore I need ABC and XYZ in two seperate measures.

Anybody with a suggestion for this problem?

 

P.s. I'm working with a live connection, so I can't make changes into my database.

  • Gjakova , measure like ?

    New York= calculate(sum(Table[revenue]),filter(table,table[city]="New York"))
    Los Angeles= calculate(sum(Table[revenue]),filter(table,table[city]="Los Angeles"))

    diff = [New York] - [Los Angeles]

4 Replies

    • Gjakova's avatar
      Gjakova
      Post Patron

      Hi amitchandak thank you for your reply.

      I think that measure is incorrect (?)

      What I mean is this, I have a column that shows the following:

      City
      New York
      Los Angeles

       

      And I have another column with revenue.

      I want to create a measure which calculates all the revenue from New York and another measure which calculates the revenue from Los Angeles.

      Furthermore, I would like to show the difference in revenue between New York and Los Angeles. But for that I could just use the measure of New York minus the measure of Los Angeles.

      But I can't get the first two measures to work, but in my mind I think it should be very simple, but I can't figure it out why it does not work.

      • amitchandak's avatar
        amitchandak
        Super User

        Gjakova , measure like ?

        New York= calculate(sum(Table[revenue]),filter(table,table[city]="New York"))
        Los Angeles= calculate(sum(Table[revenue]),filter(table,table[city]="Los Angeles"))

        diff = [New York] - [Los Angeles]