Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
I have a measure returning an incorrect result in some cases and I can't figure out why. Please help!
(In the following example, i have removed all the non-problematic data)
The goal is to show amounts owed that were 60 to 90 days old at a date specified by the user. To do that, I use two measure.
[Slicer] returns the last date on the calendar table based on the value selected by the user on the slicer.
Slicer = MAXX(ALLSELECTED('Calendar'[Date]),[Date])
[60-90 days] sums all the Montant_Net (net amount in french sorry) if the Date_Du is 61 and 90 day old based on report date (the date selected by the user and returned by the Slicer Measure).
60-90 days = CALCULATE(SUM(GL[Montant_Net]), FILTER('GL', DATEDIFF(GL[Date_Du],[Slicer],DAY)>=61 && DATEDIFF(GL[Date_Du],[Slicer],DAY)<=90))
Here is an example PBIX file: https://drive.google.com/file/d/1j4i6j7AZnXtm_S_x91dd2uorg2cxaxjH/view?usp=drive_link
In that example, 2023-08-31 is selected by the user on the slicer and the the expected result of [60-90 days] would be 0 since no entries were between 61 and 90 days old. Yet the measure returns 1 724 625$. Also, I can't explain why but if I edit the measure to <=87 or less, it returns 0.
I have spent a few hours on this issue and tried many things including:
- Using a calculated table instead of a measure
- Changing the type of all my dates to date or date time
- Using AND() instead of && or using various other syntax instead of DATEDIFF
I can't understand what's causing this. Any help will be greatly appreciated.
@Camseg This works:
60-90 days NC =
VAR __Slicer = MAX('Calendar'[Date])
VAR __Table = FILTER('GL', DATEDIFF(GL[Date_Du],__Slicer,DAY)>=61 && DATEDIFF(GL[Date_Du],__Slicer,DAY)<=90)
VAR __Result = SUMX(__Table, [Montant_Net])
RETURN
__Result
Hi @Greg_Deckler , thank you for your reply.
It does return 0 but when I add more data (that was hidden for the example) it always return 0 no matter the data.
As an example, here, GL_ID 441977 and 444399 should be included as they are 71 day old.
Same example as before but with more data:
https://drive.google.com/file/d/1j4i6j7AZnXtm_S_x91dd2uorg2cxaxjH/view?usp=drive_link
hi @Camseg ,
try like:
Hi! Thank you for your quick reply.
Result is unchanged with the ALL(). I failed to mention it but I tried various combination of ALL() ALLEXCEPT() ALLSELECTED().
User | Count |
---|---|
20 | |
14 | |
11 | |
8 | |
6 |
User | Count |
---|---|
23 | |
23 | |
20 | |
15 | |
10 |