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 all,
I am dealing with a dataset about student lateness, with the following columns:
Day_x_Student_ID, Date, Student_ID, Late_min, Mentor_ID
I wanted to create a Column to determine whether the student is late for a given day:
IS_LATE = if(Late_min > Late_Threshold, True, Flase), where the Late_Threshold is determined by a slicer on a numeric range parameter.
I cannot use a measure, because a student can has 1 - N mentors for any given day. In order to present mentor-level data, each day can be duplicated for a student for a given day. Currently, I used
IS_LATE = if(Late_min > Late_Threshold, Day_x_Student_ID), and used a measure
Solved! Go to Solution.
Hello @tzuchiao,
Can you please try this approach:
Count_Late_Days =
VAR SelectedThreshold = SELECTEDVALUE(Late_Threshold[Late Threshold], 10)
RETURN
CALCULATE(
DISTINCTCOUNT(StudentData[Day_x_Student_ID]),
FILTER(
StudentData,
StudentData[Late_min] > SelectedThreshold
)
)
Hello @tzuchiao,
Can you please try this approach:
Count_Late_Days =
VAR SelectedThreshold = SELECTEDVALUE(Late_Threshold[Late Threshold], 10)
RETURN
CALCULATE(
DISTINCTCOUNT(StudentData[Day_x_Student_ID]),
FILTER(
StudentData,
StudentData[Late_min] > SelectedThreshold
)
)
Hi @tzuchiao ,
The issue you’re facing arises because calculated columns in Power BI are computed at the data model level and are static—they don’t dynamically respond to slicers or filters in reports. This is why your calculated column cannot use the dynamic Late Threshold Value from the slicer.
Instead of a calculated column, you can use a measure to determine whether the student was late. Here's how:
Define the measure:
Is_Late = VAR Late_Threshold_Value = SELECTEDVALUE('Late_Threshold'[Late Threshold], 10) RETURN IF( MAX('Table'[Late_min]) > Late_Threshold_Value, TRUE(), FALSE() )
Use this measure in your visualizations. For example, you can count the number of late days per mentor using:
Late_Days_Count = COUNTX( FILTER( 'Table', [Is_Late] = TRUE() ), 'Table'[Day_x_Student_ID] )
This avoids creating a static column and directly ties the logic to the slicer.
If you need mentor-level or day-level aggregations, create an additional measure to calculate the distinct count of late days:
Late_Day_Count = VAR Late_Threshold_Value = SELECTEDVALUE('Late_Threshold'[Late Threshold], 10) RETURN DISTINCTCOUNT( FILTER( 'Table', 'Table'[Late_min] > Late_Threshold_Value ) )
If slicer-based dynamic behavior isn’t mandatory, you can pre-compute the "Is_Late" column in Power Query by defining a threshold value (e.g., 10 minutes). You’ll lose slicer interactivity but avoid complexity:
Go to Power Query Editor.
Add a conditional column:
Load the data back to Power BI.
If you want dynamic behavior with slicers but still need row-level filtering, you can create a calculated table with slicer-driven filtering:
Create a calculated table:
Late_Students = FILTER( 'Table', 'Table'[Late_min] > SELECTEDVALUE('Late_Threshold'[Late Threshold], 10) )
Use this table in visuals for mentor-level analysis.
Thank you FarhanJeelani,
I tried out a few functions you mentioned, but I have arrived at the same answer Sahir Mahara provided later, so I chose his as the answer. (You're the one that actually helped! Thank you so much!)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
119 | |
83 | |
47 | |
42 | |
33 |
User | Count |
---|---|
190 | |
79 | |
72 | |
52 | |
46 |