Forum Discussion

NMK's avatar
NMK
New Member
2 years ago
Solved

Power Bi Working hours

Hello,

I am having issues with working hours table created in power Bi. I created working hours for the year 2024. However, power Bi is showing negative values for the month August 2024. Ideally it should show zero since August is yet to come.

I am lost as I don't know why this is happening as  the values for the rest of the month is correct.

Any help is greatly appreciated!

 

 Thanks 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi NMK ,

    Since I don't have your data source, I assumed a table and did a test for your reference.

    My Model View:

    Month = [Date].[Month]

    MonthNo = 'Table'[Date].[MonthNo]

    The MonthNo column is used to sort the months by numeric size in the visualization.

    Measure =

    VAR _today = MONTH(CALCULATE(MAX([Date]), ALL('Table')))

    VAR _sum = CALCULATE(SUM('Table'[Value]), ALLEXCEPT('Table', 'Table'[Month]))

    RETURN

    IF(MONTH(MAX([Date])) < _today, _sum, 0)

     

    If this sample data is structurally different from the one you are using, please provide detailed sample data and the results you are hoping for. How to provide sample data in the Power BI Forum - Microsoft Fabric Community Or show them as screenshots or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.

     

    Best Regards,

    Sunshine Gu

6 Replies

  • SachinNandanwar's avatar
    SachinNandanwar
    Impactful Individual

    Please post some sample data for everyone to understand your problem better.

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    NMK I second SachinNandanwar Here is some information to help you frame your question. Sorry, having trouble following, can you post sample data as text and expected output?
    Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

    Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

    The most important parts are:
    1. Sample data as text, use the table tool in the editing bar
    2. Expected output from sample data
    3. Explanation in words of how to get from 1. to 2.

  • NMK's avatar
    NMK
    New Member

    Above is a sample example of the issue . The values shown are the sum of working hours for each month for the year 2024. The values are correct for all the months until July. For the month of August, sum of working hours should be 0 since no one worked for August yet however it's showing negative value .

    Thanks 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi NMK ,

        Since I don't have your data source, I assumed a table and did a test for your reference.

        My Model View:

        Month = [Date].[Month]

        MonthNo = 'Table'[Date].[MonthNo]

        The MonthNo column is used to sort the months by numeric size in the visualization.

        Measure =

        VAR _today = MONTH(CALCULATE(MAX([Date]), ALL('Table')))

        VAR _sum = CALCULATE(SUM('Table'[Value]), ALLEXCEPT('Table', 'Table'[Month]))

        RETURN

        IF(MONTH(MAX([Date])) < _today, _sum, 0)

         

        If this sample data is structurally different from the one you are using, please provide detailed sample data and the results you are hoping for. How to provide sample data in the Power BI Forum - Microsoft Fabric Community Or show them as screenshots or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.

         

        Best Regards,

        Sunshine Gu