Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
So I was wondering how I would calculate the difference in DAX between two products in my table for the same date so I can see how the price spread changes over time. So my table would look like this:
Date | Product | Price |
7/18/2019 | Corn | 100 |
7/18/2019 | Sugar | 50 |
7/17/2019 | Corn | 90 |
7/17/2019 | Sugar | 60 |
And I would like this kind of output:
Corn minus Sugar | |
7/18/2019 | 50 |
7/17/2019 | 30 |
Ideally I would also be changing the dates (so maybe only charting the spread evolution over last 6 months) so FILTER incorporation would be ideal. Thanks in advance for any insight on how I could do this!
Solved! Go to Solution.
Assuming you only have two products, try the below measure:
Measure = CALCULATE(SUM('Table'[Price]),'Table'[Product]="Corn") - CALCULATE(SUM('Table'[Price]),'Table'[Product]="Sugar")
Assuming you only have two products, try the below measure:
Measure = CALCULATE(SUM('Table'[Price]),'Table'[Product]="Corn") - CALCULATE(SUM('Table'[Price]),'Table'[Product]="Sugar")
That works! While there are more than one product, I can just make different measures because each product actually has a lot of other attributes attached (the same product will actually have multiple attributes that I will need to differentiate by like vendor source). Now that I have the framework I will give it a shot. Thanks!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
104 | |
96 | |
80 | |
67 | |
62 |
User | Count |
---|---|
137 | |
106 | |
104 | |
81 | |
63 |