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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jjmartinso
Frequent Visitor

If a measure is less than a table value then 1 else 0

I have created a measure to calc the % of days an employee is on the schedule based on the selected dates.  I want to compare that to how many days the employee should appear on the schedule based on employee's defined schedule.  In trying to create a filter for my table, I am trying to produce a 1 or a 0 based on var x and the table value. 

 

The table is structured like the below with a date slicer linked to the table:

RegionSiteNameEmployeeID% of Days on Schedule

The % of Days on Schedule uses the var x calculation, shown below.

 

Trigger =
var x = DIVIDE(COUNTA('ScheduleData'[EmployeeID]), COUNTA('Dates'[Date]))
return
IF(x<'DriverDetails'[%DaysWeek],1,0)
 
The above is returning this error:
A single value for column '%DaysWeek' in table 'DriverDetails' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
 
I have searched for a solution and tried various modifications to get this to work but have been unsuccessful.  Any thoughts on the direction I should take?
 
1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@jjmartinso Try:

Trigger =
var x = DIVIDE(COUNTA('ScheduleData'[EmployeeID]), COUNTA('Dates'[Date]))
return
IF(x<MAX('DriverDetails'[%DaysWeek]),1,0)

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
jjmartinso
Frequent Visitor

Doh, I think I will commence banging my head against my desk.  I can't believe I spent a while on that one.  
Appreciate your help!

@jjmartinso Sometimes just takes another pair of eyes.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

@jjmartinso Try:

Trigger =
var x = DIVIDE(COUNTA('ScheduleData'[EmployeeID]), COUNTA('Dates'[Date]))
return
IF(x<MAX('DriverDetails'[%DaysWeek]),1,0)

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.