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
mrslyfox
Helper II
Helper II

Actual Working days and month days

Hello,

 

have a formula  = (actual month sales/act month working days) * working days in month.

Model contain Calendar table with key whitch indicate is it a working days or not [WordkingDayYN]

And Fact Sales tables by dates

 

I need to create a Chart with Sales on Y and MonthNames on X for selected year.

1 ACCEPTED SOLUTION

Hi @mrslyfox,

 

Please try:

MTD Sales =
CALCULATE (
    SUM ( Sales[Sales] ),
    FILTER ( 'Calendar', 'Calendar'[LINK_Date].[Day] <= DAY ( TODAY () ) )
)

MTD working days =
CALCULATE (
    SUM ( 'Calendar'[WorkingDay] ),
    FILTER ( 'Calendar', 'Calendar'[LINK_Date].[Day] <= DAY ( TODAY () ) )
)

Working days total per month =
CALCULATE (
    SUM ( 'Calendar'[WorkingDay] ),
    ALLEXCEPT ( 'Calendar', 'Calendar'[LINK_Date].[Month] )
)

Act Sales = [MTD Sales]/[MTD working days]*[Working days total per month]

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
v-yulgu-msft
Employee
Employee

Hi @mrslyfox,

 

Not very clear about the difference between the two highlighted parts.

2.PNG

 

Based on my assumption, the former one means the actual working days per month depend on the values of [WorkingDayYN], the latter one means the number of dates each month.

 

If that is the case, please try below measures:

Month Total Sales =
CALCULATE (
    SUM ( Sales[Sales] ),
    ALLEXCEPT ( 'Calendar', 'Calendar'[LINK_Date].[Month] )
)

Woring day per month =
CALCULATE (
    COUNTROWS ( 'Calendar' ),
    ALLEXCEPT ( 'Calendar', 'Calendar'[LINK_Date].[Month] )
)

Actual Woring days =
CALCULATE (
    SUM ( 'Calendar'[WorkingDay] ),
    ALLEXCEPT ( 'Calendar', 'Calendar'[LINK_Date].[Month] )
)

Act Sales = [Month Total Sales]/[Actual Woring days]*[Woring day per month]

Please refer to the uploaded .pbix file for details.

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yulgu-msft

 

Example:

Today: 26 - October
Act Sales = MTD Sales for October = 22 645 684.89

October Calendar days: 31

working days in month = October Total Working days Total = 22

act month working days = October MTD Working days = 19

 

resuted formula: = 22 645 684.89 / 19 * 22 = 26 221 319.34

up

Hi @mrslyfox,

 

Please try:

MTD Sales =
CALCULATE (
    SUM ( Sales[Sales] ),
    FILTER ( 'Calendar', 'Calendar'[LINK_Date].[Day] <= DAY ( TODAY () ) )
)

MTD working days =
CALCULATE (
    SUM ( 'Calendar'[WorkingDay] ),
    FILTER ( 'Calendar', 'Calendar'[LINK_Date].[Day] <= DAY ( TODAY () ) )
)

Working days total per month =
CALCULATE (
    SUM ( 'Calendar'[WorkingDay] ),
    ALLEXCEPT ( 'Calendar', 'Calendar'[LINK_Date].[Month] )
)

Act Sales = [MTD Sales]/[MTD working days]*[Working days total per month]

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
SivaMani
Resident Rockstar
Resident Rockstar

@mrslyfox,

 

Create a relationship between the tables. 

 

Add the required fields to the chart.

 

 

@SivaMani

 

relationship exist, how DAX measure will looks like ?

@mrslyfox,

 

Just to share some sample data and we will proceed further.

up

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.