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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
khalidjou
Frequent Visitor

Filter

Hi all, 

I have a table with date and time. I want to exlude the rows with time = 00:00:00 to compute the max Occupation.

I've written a mesure that gives the maximum occupation but with time = 00:00:00 included

 

Max_occup =
var Datum= DATE([max_Année];[max_month];[max_jour])
var Bi=CALCULATE(MAXA(tblname[Occupation]);tblname[Date]=Datum)
return
Bi
 
*************************NB: I am on direct query

************************************

Thank you

 

khalidjou_0-1662496717190.png

 

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @khalidjou 

 

You can try this measure

Max_occup =
VAR Datum =
    DATE ( [max_Année]; [max_month]; [max_jour] )
VAR Bi =
    CALCULATE (
        MAXA ( tblname[Occupation] );
        tblname[Date] = Datum;
        TIMEVALUE ( tblname[Date] ) <> TIME ( 0; 0; 0 )
    )
RETURN
    Bi

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @khalidjou 

 

You can try this measure

Max_occup =
VAR Datum =
    DATE ( [max_Année]; [max_month]; [max_jour] )
VAR Bi =
    CALCULATE (
        MAXA ( tblname[Occupation] );
        tblname[Date] = Datum;
        TIMEVALUE ( tblname[Date] ) <> TIME ( 0; 0; 0 )
    )
RETURN
    Bi

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

amitchandak
Super User
Super User

@khalidjou , You need like

 

new meausre =
CALCULATE(MAXA(tblname[Occupation]);filter(allselected(tblname) , tblname[Date]=max(tblname[Date]) && timevalues([tblname[Date]) <> time(0,0,0)))

 

or only date part of the date

 

Only date column =  datevalue([Date])

 

new meausre =
CALCULATE(MAXA(tblname[Occupation]);filter(allselected(tblname) , tblname[Only Date]=max(tblname[Only Date]) && timevalues([tblname[Date]) <> time(0,0,0)))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you Amitchandak, 

Another question please. When I finf the Max occupation, how can I get the corresponding date ?

khalidjou_0-1662520828353.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.