Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I will like to get the difference between two measure values using DAX
AADPMAU_Increase = [AADPMAU_End] - [AADPMAU_Start]
But when I do the subtraction, I am getting 0
I have tried different things, but nothing is working
The two values are start and end values that are set by date selector filters. It appears that the calculation is always treating both as equal therefore returning 0
AADPMAU_Start = CALCULATE(AADPTable[AADPMAU_Sum],FILTER(DimDate,DimDate[StartDate] = DimDate[StartDate]))
AADPMAU_End = CALCULATE(AADPTable[AADPMAU_Sum],FILTER(DimDate,DimDate[EndDate] = DimDate[EndDate]))
AADPMAU Increase =
var at_end = AADPTable[AADPMAU_End]
var at_start = AADPTable[AADPMAU_Start]
return at_end - at_start
Solved! Go to Solution.
Thanks so much. I have found the solution. I will post it here soon, hopefully
Hi:
You can try the following. Assuming your date slicer is from date table.
I need the AADPMAU Increase in the values associated with the date changes (and not the difference in dates)
Do you have any suggestion how I can use your approach to calculate the difference?
Hi:
I can check it out but ask for some data , like you are working with.
Even if it's excel with made up info it's fine.
Thanks..
I have the sample PBIX file with the problem scenario but I see no way to send that file to you. Do you know how I may be able to send it to you?
Hi:
If yu use dropbox or google drive you can upload to those site and grab a link and paste it into your message.
If you want you can send to my email skelleybill@gmail.com
Thanks.
Thanks so much. I have found the solution. I will post it here soon, hopefully
The solution is to use the User Relationships approach.
1. You have to put the StartDate and EndDate fields into two separate tables (for example DimDate and DimEndDate, respectively).
2. Make both of these tables have a relationship with the main table that have the values you are looking to filter based on the StartDate and EndDate slicers
In our example, that table and field to be filtered is AADPTable[AADPMAU_Sum]
3. Since you can only have one active relationship at a time, you make the relationship between the DimDate and AADPTable the active one, with a relationship based on the FactDate field
AND you make the relationship between the DimEndDate and AADPTable the INACTIVE one, also with a relationship based on the FactDate field
4. Having set things up as described above,
The AADPMAU_Sum value associated with the StartDate slicer would be as follows:
This article explains User Relationships Using USERELATIONSHIP in DAX - SQLBI
User | Count |
---|---|
50 | |
23 | |
18 | |
18 | |
14 |
User | Count |
---|---|
91 | |
85 | |
46 | |
28 | |
21 |