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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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.

 

v-rongtiep-msft
Community Support
Community Support

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.