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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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