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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Max per group using filter with DAX

Greetings, i have a table with 3 columns: date, machine and signal (there are lots of machines and signals and date is updated daily)

 

DateMachineSignal
25/03/2021xA
25/03/2021xB
25/03/2021yA
25/03/2021yB
25/03/2021yC
26/03/2021xC
26/03/2021xA
27/03/2021xA
27/03/2021xB
27/03/2021yC

 

What i need is to find out for an specific day how long it has been since i received signals from machines, for example for march 27 it would be:

 

 ABC
x001
y220

 

anf for march 26 it would be:

 

 ABC
x010
y111

 

I know this is max per group related, but could not came up with the right measure, any help would be appreciated.

 

Regards

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Vera_33 

Thanks for your answer, since i have lots of signals i have to use a matrix visual for the columns.

 

With your help i´ve managed to make a measure that returns exactly what i need, but i have to use two date slicers:

 

yuca.png

 

This is the measure i used:

 

MaxPC =
var fecfin = MAX(Fecha[Date])
var fecini = CALCULATE(MAX(table[date]),ALLEXCEPT(table,table[equip],table[signal],table[date]))
return
DATEDIFF(fecini,fecfin,DAY)

View solution in original post

2 REPLIES 2
Vera_33
Resident Rockstar
Resident Rockstar

Hi @Anonymous 

 

Do you have a Date table with relationship to this table? I have one, the slicer coming from date column from this Date table

test = 
VAR CurDate = SELECTEDVALUE('Date'[Date])
VAR LDate = COALESCE(MAXX(FILTER(yourTable,yourTable[Date]<=CurDate),yourTable[Date]),CurDate)
RETURN
DATEDIFF(LDate,CurDate,DAY)

 

Vera_33_0-1617160195226.png

 

Anonymous
Not applicable

Hi @Vera_33 

Thanks for your answer, since i have lots of signals i have to use a matrix visual for the columns.

 

With your help i´ve managed to make a measure that returns exactly what i need, but i have to use two date slicers:

 

yuca.png

 

This is the measure i used:

 

MaxPC =
var fecfin = MAX(Fecha[Date])
var fecini = CALCULATE(MAX(table[date]),ALLEXCEPT(table,table[equip],table[signal],table[date]))
return
DATEDIFF(fecini,fecfin,DAY)

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors