Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
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).
How do I get the daily budget line to stop at 12/31/2023? Thanks.
Solved! Go to 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 )
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.
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 )
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
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.
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.
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 )
I haven't adapted the dax to my own report yet but the dax's logic seems sound, thanks!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 9 | |
| 8 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 23 | |
| 14 | |
| 10 | |
| 6 | |
| 5 |