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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Jens1983
New Member

Cumulative Actuals with Filtering

Hi everybody,

 

for cumulating my actuals i used the following code and it works fine:

 

Cumulative Actuals = CALCULATE(SUM(Actuals[VAlue]), FILTER(All(Actuals), Actuals[Period] <= MAX(Actuals[Period])))

 

But the problem is, that when i want to attach filters to my visuals, they are being ignored. How do i get this flexibility? I think ithas something to do with the "All" Funktion in the code which keeps ignoring filters?

 

Greetings

 

Jens 

1 ACCEPTED SOLUTION
v-kaiyue-msft
Community Support
Community Support

Hi @Jens1983 ,

 

I want to validate the valuable input provided by @nandic . Their initial thoughts helped guide my approach. However, I noticed that more detail is needed to fully understand the problem.

 

In the ALLSSELECTED calculation, only the filters inside the visual object are ignored. This is different from the way ALL behaves. From the ALL function's point of view, all filters inside or outside the visual object are ignored. More details can be found in the link : Power BI DAX: ALL vs. ALLSelected - RADACAD.

 

I created two MEASURES.

Measure =
CALCULATE(SUM(financials[ Sales]),FILTER(ALL(financials),'financials'[Date] <= MAX('financials'[Date])))

 

Measure 2 =
CALCULATE(SUM(financials[ Sales]),FILTER(ALLSELECTED(financials[Date]),'financials'[Date] <= MAX('financials'[Date])))


They return the same result when there is no data selected in the slicer.

vkaiyuemsft_0-1715674031328.png

 

When I filter in the slicer, the MEASURES remain the same results, while MEASURES 2 returns the new values. More details can be found in the pbix attachment.

vkaiyuemsft_1-1715674041202.png

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

2 REPLIES 2
v-kaiyue-msft
Community Support
Community Support

Hi @Jens1983 ,

 

I want to validate the valuable input provided by @nandic . Their initial thoughts helped guide my approach. However, I noticed that more detail is needed to fully understand the problem.

 

In the ALLSSELECTED calculation, only the filters inside the visual object are ignored. This is different from the way ALL behaves. From the ALL function's point of view, all filters inside or outside the visual object are ignored. More details can be found in the link : Power BI DAX: ALL vs. ALLSelected - RADACAD.

 

I created two MEASURES.

Measure =
CALCULATE(SUM(financials[ Sales]),FILTER(ALL(financials),'financials'[Date] <= MAX('financials'[Date])))

 

Measure 2 =
CALCULATE(SUM(financials[ Sales]),FILTER(ALLSELECTED(financials[Date]),'financials'[Date] <= MAX('financials'[Date])))


They return the same result when there is no data selected in the slicer.

vkaiyuemsft_0-1715674031328.png

 

When I filter in the slicer, the MEASURES remain the same results, while MEASURES 2 returns the new values. More details can be found in the pbix attachment.

vkaiyuemsft_1-1715674041202.png

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

nandic
Memorable Member
Memorable Member

@Jens1983 function ALL removes all filters from table Actuals and then applies only period <= max period.
Everything else is not applied due to ALL function.

What you can try is to do ALL(Actuals[Period]) - so removing filters impacting only this column, not whole table.
Or using ALLSELECTED(Actuals) instead of ALL(Actuals).

Cheers,
Nemanja Andic

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors