Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Giada90
Helper III
Helper III

dax formula

Hi,

I have a datasource like this:

Giada90_0-1721739844099.png

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

Giada90_1-1721739920960.png

how can I do?

thanks

1 ACCEPTED SOLUTION
audreygerred
Super User
Super User

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.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

3 REPLIES 3
Giada90
Helper III
Helper III

THANKS!

You're very welcome!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





audreygerred
Super User
Super User

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.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.