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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
edtm
Frequent Visitor

Extend month beginning amount to the rest of the month on line chart with date hierarchy.

Hello.  I am trying to create a line chart that displays daily sales/sales projection vs daily budget for the whole year.  We do not have a daily budget, so daily budget is derived by monthly budget divided by days in month ( monthly budget / days in month).  And, our monthly budget is allocated to the first of each month.  This is fine for January thru November.  However, in December, the daily budget line stops at 12/1/2023 (see chart below). 

 

chart2.JPG

 

How do I get the daily budget line to stop at 12/31/2023?  Thanks.

 

1 ACCEPTED SOLUTION

Hi,

Thank you for your message.

Could you please try the below measure for Budget daily2 whether it suits your requirement?

 

Budget daily2: =
VAR _countdays =
    COUNTROWS (
        FILTER (
            ALL ( 'x Calendar' ),
            'x Calendar'[Month-Year sort] = MAX ( 'x Calendar'[Month-Year sort] )
        )
    )
VAR _startingdate =
    MINX (
        FILTER (
            ALL ( 'x Calendar' ),
            'x Calendar'[Month-Year sort] = MAX ( 'x Calendar'[Month-Year sort] )
        ),
        'x Calendar'[Date]
    )
VAR _budgetmonthly =
    SUMX (
        FILTER ( ALL ( 'x Budget J' ), 'x Budget J'[Month] = _startingdate ),
        'x Budget J'[Budget]
    )
RETURN
    DIVIDE ( _budgetmonthly, _countdays )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

8 REPLIES 8
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

I hope the below can provide some ideas on how to create a solution for your datamodel.

 

Jihwan_Kim_0-1685853225553.png

 

Budget daily: = 
VAR _countdays =
    COUNTROWS (
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[Month-Year sort] = MAX ( 'Calendar'[Month-Year sort] )
        )
    )
VAR _startingdate =
    MINX (
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[Month-Year sort] = MAX ( 'Calendar'[Month-Year sort] )
        ),
        'Calendar'[Date]
    )
VAR _budgetmonthly =
    SUMX ( FILTER ( Budget, Budget[Month] = _startingdate ), Budget[Budget] )
RETURN
    DIVIDE ( _budgetmonthly, _countdays )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Hi Jihwan.

 

I think you are understanding my requirements correctly and the dax you provided are sound.  However, I was not able to replicate the results in my pbix file.  And, I found the reason why.  The Calendar and Budget table in your file is not related.  Unfortunately, my reports require that the Calendar and Budget table are connected as their are many other dimensions in the Budget table such as Product and Customer.

Is there a way you could enhance your dax so that calendar and budget table is joined but it also removes the date filter so that only year and month relationship is kept?

Regards,

 

Ed

chart3.JPG

Hi,

Thank you for your message, and please share your sample pbix file's link, and then I can try to look into it to come up with more accurate solution.

Thank you.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Here's a sample file.

Extend Days 

I uploaded file to google drive.  Not sure how else I can share the file since I am not a super user or ms employee.  Personally, I am not able to open the file after I dl from Google drive.

Hi,
I see the below message.

Jihwan_Kim_0-1686107533602.png

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Another link to file since the G drive wasn't working for me: 

Sample file 

Hi,

Thank you for your message.

Could you please try the below measure for Budget daily2 whether it suits your requirement?

 

Budget daily2: =
VAR _countdays =
    COUNTROWS (
        FILTER (
            ALL ( 'x Calendar' ),
            'x Calendar'[Month-Year sort] = MAX ( 'x Calendar'[Month-Year sort] )
        )
    )
VAR _startingdate =
    MINX (
        FILTER (
            ALL ( 'x Calendar' ),
            'x Calendar'[Month-Year sort] = MAX ( 'x Calendar'[Month-Year sort] )
        ),
        'x Calendar'[Date]
    )
VAR _budgetmonthly =
    SUMX (
        FILTER ( ALL ( 'x Budget J' ), 'x Budget J'[Month] = _startingdate ),
        'x Budget J'[Budget]
    )
RETURN
    DIVIDE ( _budgetmonthly, _countdays )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

I haven't adapted the dax to my own report yet but the dax's logic seems sound, thanks! 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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