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.
Hello,
To provide a bit more context, i am trying to count all the records, on a rolling basis, 1 month before any agreed delivery date. So any record, that has a delivery date in the upcoming 1 month must be counted.
I am a bit confused about the way DATEADD function works. The two measures below give me different answers, only difference being one is in DAYS and one is in MONTH
1 month to Agreed delivery date = CALCULATE(
COUNTROWS('TP_ACTIVITIES'),
DATEADD('TP_ACTIVITIES'[AgreedDeliveryDate], -1, MONTH)
)
1 month to Agreed delivery date =
CALCULATE(
COUNTROWS('TP_ACTIVITIES') ,
FILTER('TP_ACTIVITIES', DATEADD('TP_ACTIVITIES'[AgreedDeliveryDate], -1, MONTH
)
)
)
There is a difference in the result, could you help me understand why?
Hi @nrj1806 ,
In my test ,the two measure return the same value ,could you pls share your sample data and output result,remember to remove confidential data.
And I add a few blogs and videos that you could reference to learn more about the function of DATEADD.
Using DATEADD() and other Date Tips for Filtering Data in Power BI
The DATEADD Function: The Best And Most Versatile Time Intelligence Function in Power BI
DATEADD function (DAX) - DAX DATEADD function In Power BI Desktop
Best Regards
Lucien
I have added a picture of the data. Both the cards should show the same numbers considering the dates in the column.
I have tried three formulas to pick the dates from last month, but they dont seem to work.
I see where i could be potentially going wrong now. I shouldnt be using 30 for month at all since some months have 31 days or 28.
Hi @nrj1806 ,
Does the month that you are using in the 1st DAX expression (of Month) the one which has 30 days in it?
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 |
---|---|
108 | |
105 | |
87 | |
74 | |
66 |
User | Count |
---|---|
124 | |
112 | |
96 | |
80 | |
72 |