Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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 |
---|---|
106 | |
89 | |
81 | |
76 | |
73 |
User | Count |
---|---|
112 | |
104 | |
96 | |
74 | |
66 |