Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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!
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
65 |
User | Count |
---|---|
136 | |
117 | |
101 | |
71 | |
61 |