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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
tomshaw83
Helper I
Helper I

DAC simple measure help - conditional count

Hi there,

 

I am after some help with a dax measure, I have 2 tables similar to the below that I am importing into the front end:-

 

Employee Table

NameMethod of TravelTime to Work
John DoeCar04:01:56
Simon ShreevesCycle01:01:56
Lucy JonesWalk00:30:24
Paul SmithWalk00:43:21
Carl MorganCar01:23:34

 

Method Average Table

Method of TravelAverage+1%+2%+3%
Car01:00:0001:06:0001:12:0001:18:00
Walk00:30:0000:33:0000:36:0000:39:00
Cycle00:40:0000:44:0000:48:0000:52:00

 

I am after a table in the front end that looks like the below, the count is based on a dynamic measure so I can use a slicer for (Average, 1%, 2%, 3%) and it recalculates accordingly. Effectively if Time to work <= (average, 1%, 2%, 3%) then count

 

Method of TravelCount
Car1
Walk1
Cycle0

 

Any help on this would be greatly appreciated


Thanks


Tom

2 REPLIES 2
tomshaw83
Helper I
Helper I

Ok, thank you, based on the assumptions above, could you give an idea what the DAX code would look like for the Travel count measure - i'm used to working with IF statements in excel, but don't know where to start in DAX

Anonymous
Not applicable

Instead of working with times, it's much easier to work with integers. Just convert the times into the total number of minutes (since you're not interested in seconds, as much as I cas see). Secondly, the second table of yours is pivoted. Unpivot it and make the columns' names (Average + 1%, +2%,...) an attribute's value and the time (integer) another attribute's value. This is how it should be done according to the philosophy of PBI. Once you have this design, it'll be dead easy to write measure(s) you're after.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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