cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
vinc Regular Visitor
Regular Visitor

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

Accepted Solutions
vinc Regular Visitor
Regular Visitor

Re: last workday, Week to 'last workday', Mtd

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
Super User III
Super User III

Re: last workday, Week to 'last workday', Mtd

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

Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
I accept Kudos :-), If you find my post helpful.

Proud to be a Datanaut!
vinc Regular Visitor
Regular Visitor

Re: last workday, Week to 'last workday', Mtd

powerBI query woked.JPG

 

Hi Tom ,

 

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

View solution in original post

Community Support Team
Community Support Team

Re: last workday, Week to 'last workday', Mtd

@vinc ,

 

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
Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors