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

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