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
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)

Follow on LinkedIn
@ 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.


Follow on LinkedIn
@ 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)

Follow on LinkedIn
@ 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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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