- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dax measure : Counting Rows for the Next Day - Help Needed!
I'm having trouble counting rows for the next day using my DAX code. Can someone please help me understand why the "NuitMatinCount" isn't returning any results?
I'd appreciate any insights into why the "NuitMatinCount" variable isn't providing the expected results. Thanks in advance!
Here's my DAX code:
Effectif Nuit =
VAR CurrentDate = MAX(data_chargeuses[Date])
VAR Next = (CurrentDate + 1)
VAR NuitSoirCount =
CALCULATE(
DISTINCTCOUNT(data_chargeuses[Nom Conducteur]),
data_chargeuses[Shift] = "Nuit-Soir",
data_chargeuses[Date] = CurrentDate
)
VAR NuitMatinCount = CALCULATE(
DISTINCTCOUNT(data_chargeuses[Nom Conducteur]),
data_chargeuses[Shift] = "Nuit-Matin",
data_chargeuses[Date] = Next
)
RETURN
NuitSoirCount + NuitMatinCount
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much, based on your response here is the solution i found
here is the code for ajustedDate
AdjustedDate =
-- This calculated column, which we will call "AdjustedDate," is used to adjust the date based on the shift.
-- If the shift is "Night-morning," the date is shifted one day backward.
-- This accounts for drivers working overnight into the morning.
IF (
data_chargeuses[Shift] = "Nuit-matin",
data_chargeuses[Date] - 1,
data_chargeuses[Date]
)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much, based on your response here is the solution i found
here is the code for ajustedDate
AdjustedDate =
-- This calculated column, which we will call "AdjustedDate," is used to adjust the date based on the shift.
-- If the shift is "Night-morning," the date is shifted one day backward.
-- This accounts for drivers working overnight into the morning.
IF (
data_chargeuses[Shift] = "Nuit-matin",
data_chargeuses[Date] - 1,
data_chargeuses[Date]
)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, @yannkonin
you should try
add new column which define nextdate
nextdate =
var currentdate = data_chargeuses[Date]
var nextdate = minx(filter(data_chargeuses, data_chargeuses[Date]>currentdate), data_chargeuses[Date])
return nextdate
and after adding new column you compare
Effectif Nuit =
VAR CurrentDate = MAX(data_chargeuses[Date])
VAR NuitSoirCount =
CALCULATE(
DISTINCTCOUNT(data_chargeuses[Nom Conducteur]),
data_chargeuses[Shift] = "Nuit-Soir",
data_chargeuses[Date] = CurrentDate
)
VAR NuitMatinCount = CALCULATE(
DISTINCTCOUNT(data_chargeuses[Nom Conducteur]),
data_chargeuses[Shift] = "Nuit-Matin",
data_chargeuses[Date] = nextdate ------ nextdate which calculate as new column and compare here with date
)
RETURN
NuitSoirCount + NuitMatinCount
Did i answer your question? Mark my post as a solution which help other people to find fast and easily.

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
08-13-2024 03:40 PM | |||
06-19-2023 06:23 AM | |||
06-26-2023 05:24 AM | |||
03-14-2024 09:24 AM | |||
04-13-2023 02:32 PM |
User | Count |
---|---|
23 | |
12 | |
10 | |
10 | |
8 |
User | Count |
---|---|
16 | |
15 | |
15 | |
12 | |
10 |