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

We'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

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.