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
Loic_Pedro_Hans
Regular Visitor

Problem with CALCULATE, lost the filter context

Hi,
 
This formula is good :
Avg Delivery Days = 
AVERAGEX (
    FILTER (
        Delivery_Dte_Fioul_Particuliers,
        NOT (Delivery_Dte_Fioul_Particuliers[AGC_LIBC] IN {"x-VDSN","T-PSE Siège",""})
    ),
    Delivery_Dte_Fioul_Particuliers[DELIVERY DATE]
)
 
This formula using CALCULTATE don't work :
Avg Delivery DaysCalc = 
CALCULATE (
    AVERAGEX (
        Delivery_Dte_Fioul_Particuliers,
        Delivery_Dte_Fioul_Particuliers[DELIVERY DATE]
    ),
    Delivery_Dte_Fioul_Particuliers[AGC_LIBC] IN {"PACA","T-PSE Siège",""}
)
 
[U]Le résultat[/U] 
 
AGC_LIBC        Avg Delivery DaysCalc Avg Delivery Days
                     2,474247287
Brg Frnch Comte     2,474247287 4,190534486
Loire Auvergne      2,474247287 2,703824046
LVDR              2,474247287 3,133449115
Lyon PDA              2,474247287 3,675738426
PACA              2,474247287 2,489297886
Savoies              2,474247287 4,485062751
T-PSE Siège     2,474247287
x-VDSN             2,474247287
 
Why when using CALCULTATE, the filter context don't work, but only a global average ?
pwb1.png
Thanks a lot
2 REPLIES 2
Loic_Pedro_Hans
Regular Visitor

Thanks Rongtie,

I Try to do a best explanation for my problem.

The problem is about CALCULATE.

 

First Syntax

Loic_Pedro_Hans_0-1692365881316.png

With this syntax the row context can be apply normaly, a different value for every Agency.

Loic_Pedro_Hans_1-1692366002526.png

If I use another formula, the value is good (3,70 TOTAL), but there is no several values with the agency context

Why ??

Loic_Pedro_Hans_2-1692366046914.pngLoic_Pedro_Hans_3-1692366060734.png

Thank a lot.

 

Anonymous
Not applicable

Hi @Loic_Pedro_Hans ,

Please have a try.

measure =
CALCULATE (
    AVERAGE ( Delivery_Dte_Fioul_Particuliers[DELIVERY DATE] ),
    FILTER (
        ALL ( Delivery_Dte_Fioul_Particuliers ),
        Delivery_Dte_Fioul_Particuliers[AGC_LIBC] IN { "PACA", "T-PSE Siège", "" }
    )
)

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.