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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

last workday, Week to 'last workday', Mtd

powerBITotaltodate.JPG

 

powerBI query.JPG

 

 

 

Hi,

 

i've been cracking my head over this.

i am trying to get the 'MotorOn Hours' for the lastWorkDay, Week todate and MTD.

I have measures to calculate the MotorOnHours for the lastworkday and MTD.

But both of them seems to be just following the slicer, if no slicer then the value would be total to date value.

 

MotorOnLastWorkday = calculate(([TotalMotorOn]), Filter(ExportPlantGPS,ExportPlantGPS[Date]=[LastWorkday2]))
 
MotorOnforthe Month = calculate(sum(ExportPlantGPS[MotorOn Hours]),month(ExportPlantGPS[Date])=month(NOW()) && year(ExportPlantGPS[Date]) = year(NOW()))
 
if i have slicer
MotorOnHoursMonth =
IF (
    HASONEVALUE ( ExportPlantGPS[YearMonth] ),
    SUM ( ExportPlantGPS[MotorOn Hours] ),
    CALCULATE (
        SUM ( ExportPlantGPS[MotorOn Hours] ),
        FILTER (
            ALL ( ExportPlantGPS ),
            YEAR ( ExportPlantGPS[Date] ) = YEAR ( SELECTEDVALUE(ExportPlantGPS[Date] )
                && MONTH ( ExportPlantGPS[Date] ) = MONTH ( SELECTEDVALUE(ExportPlantGPS[Date] )
        )
    )
)))
1 ACCEPTED SOLUTION
Anonymous
Not applicable

powerBI query woked.JPG

 

Hi Tom ,

 

thanks for the help. I've managed to get it working.

View solution in original post

3 REPLIES 3
TomMartens
Super User
Super User

Hey,

 

I have to admit that I do not understand, what you expect. For this reason I ask you to prepare a pbix that contains sample data (ideally using the "Enter data function") that represents your data model, upload the pbix to onedrive or dropbox and share the link.

 

Please, take some time to describe what you expect as an outcome, especially in consideration of the date range slicer. Describe the expected results using an xlsx file, upload the xlsx and share the link as well.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

powerBI query woked.JPG

 

Hi Tom ,

 

thanks for the help. I've managed to get it working.

@Anonymous ,

 

By the way, you may help accept solution. Your contribution is highly appreciated.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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