March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi.
I would like to create a measure caluculating the green column below. For each month I have the actual sales and the number of working days. The outcome should be a line chart where you see the accumulated sales per working day. I keep getting the monthly average in the blue column, so any suggestions to get to the green result? 🙂
Thanks a lot in advance.
Solved! Go to Solution.
Hi @HLVW ,
I create a table as you mentioned.
Then I create a measure named Avg. Sales pr day.
Avg. Sales pr day =
CALCULATE (
SUM ( 'Table'[Monthly Sales] ) / SUM ( 'Table'[Working days] ),
FILTER (
ALLSELECTED ( 'Table'[Month] ),
ISONORAFTER ( 'Table'[Month], MAX ( 'Table'[Month] ), DESC )
)
)
Finally I create another measure to get what you want.
Avg. Sales pr day YTD =
DIVIDE (
CALCULATE ( SUM ( 'Table'[Acc. Sales] ), ALLSELECTED ( 'Table'[Month] ) ),
CALCULATE ( SUM ( 'Table'[Acc. Days] ), ALLSELECTED ( 'Table'[Month] ) )
)
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Share the download link of the PBI file.
Hi @HLVW ,
I create a table as you mentioned.
Then I create a measure named Avg. Sales pr day.
Avg. Sales pr day =
CALCULATE (
SUM ( 'Table'[Monthly Sales] ) / SUM ( 'Table'[Working days] ),
FILTER (
ALLSELECTED ( 'Table'[Month] ),
ISONORAFTER ( 'Table'[Month], MAX ( 'Table'[Month] ), DESC )
)
)
Finally I create another measure to get what you want.
Avg. Sales pr day YTD =
DIVIDE (
CALCULATE ( SUM ( 'Table'[Acc. Sales] ), ALLSELECTED ( 'Table'[Month] ) ),
CALCULATE ( SUM ( 'Table'[Acc. Days] ), ALLSELECTED ( 'Table'[Month] ) )
)
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @HLVW - I mean instead of colors, as i understood, the logic to calculate the average sales per day
can you try the below dax logic with datesytd function and number of days ytd as seperate measures
-- Total Sales YTD
TotalSalesYTD =
CALCULATE(
SUM(Sales[SalesAmount]),
DATESYTD('Date'[Date])
)
-- Number of Days YTD
DaysYTD =
CALCULATE(
COUNTROWS('Date'),
DATESYTD('Date'[Date])
)
-- Average Sales Per Day YTD %
AverageSalesPerDayYTD =
DIVIDE([TotalSalesYTD], [DaysYTD])
if the above not works, please try the solution link below for your reference.
Solved: ytd running - Microsoft Fabric Community
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
Proud to be a Super User! | |
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |