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
Lund
Frequent Visitor

Month budget to daily

Hi Everyone

 

I have this tables with my cutomers budget amount month by month.

But i need to split it up in a messaure, so i get the budget day by day, how can i sovle that?

bi 4.png

1 ACCEPTED SOLUTION
sturlaws
Resident Rockstar
Resident Rockstar

Hi, @Lund

 

there are numeros ways to achieve what your are after, depending on your scenario. E.g. is it direct query or import? What does your data model look like? Do you want the budget spread over all days of the month, or just workdays? Should you handle national holidays?

Assuming that you have a date table in your model, and you want to divide the monthly budget by number of workdays in the month, you can create a measure like this:

Daily budget =
VAR _date =
    CALCULATE ( SELECTEDVALUE ( DimDate[Date] ) )
VAR _month =
    MONTH ( _date )
VAR _year =
    YEAR ( _date )
VAR _workdays =
    CALCULATE (
        COUNTROWS ( DimDate ),
        FILTER (
            ALL ( DimDate ),
            YEAR ( DimDate[Date] ) = _year
                && MONTH ( DimDate[Date] ) = _month
                && WEEKDAY ( DimDate[Date], 2 ) < 6
        )
    )
RETURN
    DIVIDE (
        CALCULATE (
            SUM ( Budget[Amount] ),
            FILTER (
                ALLEXCEPT ( Budget, Budget[CustomerNo], Budget[code] ),
                YEAR ( Budget[Date] ) = _year
                    && MONTH ( Budget[Date] ) = _month
            )
        ),
        _workdays
    )

 

Then create a table visual with dates and this measure and you should get something like this:

sturlaws_0-1670447179474.png

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

 

View solution in original post

1 REPLY 1
sturlaws
Resident Rockstar
Resident Rockstar

Hi, @Lund

 

there are numeros ways to achieve what your are after, depending on your scenario. E.g. is it direct query or import? What does your data model look like? Do you want the budget spread over all days of the month, or just workdays? Should you handle national holidays?

Assuming that you have a date table in your model, and you want to divide the monthly budget by number of workdays in the month, you can create a measure like this:

Daily budget =
VAR _date =
    CALCULATE ( SELECTEDVALUE ( DimDate[Date] ) )
VAR _month =
    MONTH ( _date )
VAR _year =
    YEAR ( _date )
VAR _workdays =
    CALCULATE (
        COUNTROWS ( DimDate ),
        FILTER (
            ALL ( DimDate ),
            YEAR ( DimDate[Date] ) = _year
                && MONTH ( DimDate[Date] ) = _month
                && WEEKDAY ( DimDate[Date], 2 ) < 6
        )
    )
RETURN
    DIVIDE (
        CALCULATE (
            SUM ( Budget[Amount] ),
            FILTER (
                ALLEXCEPT ( Budget, Budget[CustomerNo], Budget[code] ),
                YEAR ( Budget[Date] ) = _year
                    && MONTH ( Budget[Date] ) = _month
            )
        ),
        _workdays
    )

 

Then create a table visual with dates and this measure and you should get something like this:

sturlaws_0-1670447179474.png

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

 

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.