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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Syndicate_Admin
Administrator
Administrator

Problem with formulating dates and holidays

Spoiler

Hello

I have a date dimension that is related to the budget.

I have another dimension holidays with day of the year granularity, delegation and indicates if that day is a working day.

I have a budget fact table that by delegation points to the first day of each month and assigns it a monthly budget.

I'm generating a measure so that every time I select a date from the "date" dimension, it calculates what the daily budget is, taking into account the working days of the month. Example: If February has 22 working days we divide the total budget and each day has to budget/22 to achieve the goal

I have commented on a part of the code that is the one that does not "pay attention" to me. Any help?




Bad Daily Goal =

Divide(

Calculate('PresupuestoVentas_All_SoloDaily'[PresupuestoVentas_All_SoloDaily' [PresupuestoVentas_All_SoloDaily],

filter(ALL('Date'),

'Date'[Month] = month(SELECTEDVALUE('Date'[DateValue])) &&

'Date'[Year] = year(SELECTEDVALUE('Date'[DateValue]))

)

/*,

Filter('Holiday Delegations',

'Holiday Delegations'[pkDayKey] = selectedvalue('Date'[DateValue]) &

'Holiday Delegations'[pkCodDelegation] = SELECTEDVALUE('Delegations All'[pkCodDelegation]) &

'Holiday Delegations'[Es_Laborable] = "S"



) */

) ,

Calculate([Total Business Days Daily Sales - All],

Filter(ALL('Date'),

'Date'[Month] = month(SELECTEDVALUE('Date'[DateValue])) &&

'Date'[Year] = year(SELECTEDVALUE('Date'[DateValue]))

)

)

,0)
1 ACCEPTED SOLUTION

Hello

The problem was that a relationship was missing from the model.

The formula was correct.

Thank you for your help.

View solution in original post

2 REPLIES 2
TDK
Frequent Visitor

Hi,

So ALL can do some strange things, I would suggest first splitting up your formula into different measures first to first try and identify what is going wrong, as my guess is the ALL is causing it to ignore your second commented out filter, I would also try the following:

 

 

Bad Daily Goal =

Divide(
            SUMX(filter(ALL('Date'),
                    'Date'[Month] = month(SELECTEDVALUE('Date'[DateValue])) &&
                    'Date'[Year] = year(SELECTEDVALUE('Date'[DateValue])) 
                    ),
                    Calculate('PresupuestoVentas_All_SoloDaily'[PresupuestoVentas_All_SoloDaily],
                                Filter('Holiday Delegations', 
                                        'Holiday Delegations'[pkDayKey] = selectedvalue('Date'[DateValue]) &
                                        'Holiday Delegations'[pkCodDelegation] = SELECTEDVALUE('Delegations All'[pkCodDelegation]) &
                                        'Holiday Delegations'[Es_Laborable] = "S"     
                                        )
                            )
                ) ,
        Calculate([Total Business Days Daily Sales - All],
                    Filter(ALL('Date'),
                    'Date'[Month] = month(SELECTEDVALUE('Date'[DateValue])) &&
                    'Date'[Year] = year(SELECTEDVALUE('Date'[DateValue])) 
                         )   
                )
                ,0)

 

 


It may also help just filtering to the holidays before anything else
or lastly you can also try ALLEXCEPT (less likely to work as I do not know the table relationships):

 

 

Bad Daily Goal =

Divide(
        Calculate('PresupuestoVentas_All_SoloDaily'[PresupuestoVentas_All_SoloDaily],
                    filter(ALLEXCEPT('Date','Holiday Delegations'[pkDayKey],'Holiday Delegations'[pkCodDelegation],'Holiday Delegations'[Es_Laborable]),
                    'Date'[Month] = month(SELECTEDVALUE('Date'[DateValue])) &&
                    'Date'[Year] = year(SELECTEDVALUE('Date'[DateValue])) 
                    ),
                    Filter('Holiday Delegations', 
                            'Holiday Delegations'[pkDayKey] = selectedvalue('Date'[DateValue]) &
                            'Holiday Delegations'[pkCodDelegation] = SELECTEDVALUE('Delegations All'[pkCodDelegation]) &
                            'Holiday Delegations'[Es_Laborable] = "S"     
                            )
                ),
        Calculate([Total Business Days Daily Sales - All],
                    Filter(ALL('Date'),
                    'Date'[Month] = month(SELECTEDVALUE('Date'[DateValue])) &&
                    'Date'[Year] = year(SELECTEDVALUE('Date'[DateValue])) 
                         )   
                )
                ,0)

 

 



Hello

The problem was that a relationship was missing from the model.

The formula was correct.

Thank you for your help.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors