Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
545
Frequent Visitor

Daily report counter isn't working

Hello, I'm facing an issue where the counter is always at 0 when i'm looking at the daily report.

 

for example this is the measure:

# Weld_reports_cur_day =
VAR x = CALCULATE(DISTINCTCOUNT(qryAssemblyProcessReport[OrderID]), NIMI_CALENDAR[# IsCurrentDay] = 1, tblStations[StationCode] = 30)
return IF(ISBLANK(x), 0, x)
 
as for the measure within the measure above, this is the code:
 
# IsCurrentDay = IF(NIMI_CALENDAR[date] = TODAY(), 1, 0)
 
In the tables everything is there, no information is missing.
What could be the issue?
1 ACCEPTED SOLUTION
123abc
Community Champion
Community Champion

It seems like you’re having trouble with a DAX measure in Power BI. The measure you’ve provided should count the distinct OrderIDs for the current day at station 30. If it’s returning 0, here are a few things to check:

  1. Data Model: Ensure that the NIMI_CALENDAR and tblStations tables are correctly related to qryAssemblyProcessReport.
  2. Filter Context: Verify that the filter context is correctly set up. The NIMI_CALENDAR[# IsCurrentDay] = 1 and tblStations[StationCode] = 30 filters should be applied correctly in the report view where you’re using this measure.
  3. Data Refresh: Make sure that the data model has been refreshed and that TODAY() is returning the correct current date.
  4. Station Code: Confirm that StationCode 30 exists in tblStations and that there are corresponding OrderIDs for the current day in qryAssemblyProcessReport.

If all the above are correct, try debugging by breaking down the measure and checking each part individually. For example, you can create a measure to check if NIMI_CALENDAR[# IsCurrentDay] is working as expected:

# Test_CurrentDay = 
CALCULATE(
    COUNTROWS(NIMI_CALENDAR),
    NIMI_CALENDAR[# IsCurrentDay] = 1
)

This will give you the count of rows in NIMI_CALENDAR where # IsCurrentDay is 1. If this returns 0, then the issue might be with the NIMI_CALENDAR[date] = TODAY() part of your # IsCurrentDay measure.

Remember to check the data type of the date column in NIMI_CALENDAR and ensure it’s a date type without a time component, as TODAY() returns only the date part. If the issue persists, please provide more details about your data model and the context in which you’re using the measure.

 

 

 

View solution in original post

1 REPLY 1
123abc
Community Champion
Community Champion

It seems like you’re having trouble with a DAX measure in Power BI. The measure you’ve provided should count the distinct OrderIDs for the current day at station 30. If it’s returning 0, here are a few things to check:

  1. Data Model: Ensure that the NIMI_CALENDAR and tblStations tables are correctly related to qryAssemblyProcessReport.
  2. Filter Context: Verify that the filter context is correctly set up. The NIMI_CALENDAR[# IsCurrentDay] = 1 and tblStations[StationCode] = 30 filters should be applied correctly in the report view where you’re using this measure.
  3. Data Refresh: Make sure that the data model has been refreshed and that TODAY() is returning the correct current date.
  4. Station Code: Confirm that StationCode 30 exists in tblStations and that there are corresponding OrderIDs for the current day in qryAssemblyProcessReport.

If all the above are correct, try debugging by breaking down the measure and checking each part individually. For example, you can create a measure to check if NIMI_CALENDAR[# IsCurrentDay] is working as expected:

# Test_CurrentDay = 
CALCULATE(
    COUNTROWS(NIMI_CALENDAR),
    NIMI_CALENDAR[# IsCurrentDay] = 1
)

This will give you the count of rows in NIMI_CALENDAR where # IsCurrentDay is 1. If this returns 0, then the issue might be with the NIMI_CALENDAR[date] = TODAY() part of your # IsCurrentDay measure.

Remember to check the data type of the date column in NIMI_CALENDAR and ensure it’s a date type without a time component, as TODAY() returns only the date part. If the issue persists, please provide more details about your data model and the context in which you’re using the measure.

 

 

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.