Forum Discussion

Giada90's avatar
Giada90
Helper IV
2 years ago
Solved

dax formula

Hi,

I have a datasource like this:

I need to make a dax formula to have this table:

how can I do?

thanks

  • Hi! First, create a measure that is for cost:

    Cost = CALCULATE(SUM('YourTable'[value], 'YourTable'[type] IN { "cost" })
    Next, create a measure for sales:
    Sales = CALCULATE(SUM('YourTable'[value], 'YourTable'[type] IN { "sales" })
     
    Now, in a matrix visual, you can put person in rows and put each of your measures in values.
     
    Alternatively, you could re-shape the data in Power Query so that it is already set up with a different column for cost and sales.
     
    Alternative to that, you could make a measure for value (Total = SUM('YourTable'[Value]), then in a matrix visual put person in rows, value (column) in the columns and Total measure in values.

3 Replies

  • Hi! First, create a measure that is for cost:

    Cost = CALCULATE(SUM('YourTable'[value], 'YourTable'[type] IN { "cost" })
    Next, create a measure for sales:
    Sales = CALCULATE(SUM('YourTable'[value], 'YourTable'[type] IN { "sales" })
     
    Now, in a matrix visual, you can put person in rows and put each of your measures in values.
     
    Alternatively, you could re-shape the data in Power Query so that it is already set up with a different column for cost and sales.
     
    Alternative to that, you could make a measure for value (Total = SUM('YourTable'[Value]), then in a matrix visual put person in rows, value (column) in the columns and Total measure in values.