cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Super User

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.
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
Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 347 members 3,200 guests
Please welcome our newest community members: