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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

deactivate slices with ALL function

Hello Community,

 

I need you help with the ALL function.

 

I built a table showing the ranking of my data extraction dates.

 

GeorgeGiannakis_1-1637158679805.png

Based on this ranking, I then calculate the differences between the newest extraction versus the previous one.

 

Diff-1_Pallets =
VAR LatestExtraction = CALCULATE(SUM(Shipments[Pallet_Num]),FILTER(Shipments,Shipments[Index] = 1))
VAR PreviousExtraction = CALCULATE(SUM(Shipments[Pallet_Num]),FILTER(Shipments,Shipments[Index] = 2))
Return
LatestExtraction - PreviousExtraction
 
In order to generate correct results,
 
  1. I then create a slicer , based on the Extraction Date column of my fact table (Shipments table) , and
  2. deactivate the relationship between this slicer and the visual showing this difference
 
I am wondering if there is a way to rewrite the measure in such a way that will not require the slicer's interaction.
 
I visited Microsoft's page to read more about ALL. I came across the below explanation.
 
GeorgeGiannakis_2-1637159016075.png

 

Thus, I wrote the below measure.

 

Diff-1_Pallets_All =
VAR LatestExtraction = CALCULATE(SUM(Shipments[Pallet_Num]),FILTER(ALL(Shipments,Shipments[Extraction Date]),Shipments[Index] = 1))
VAR PreviousExtraction = CALCULATE(SUM(Shipments[Pallet_Num]),FILTER(ALL(Shipments,Shipments[Extraction Date]),Shipments[Index] = 2))
Return
LatestExtraction - PreviousExtraction
 
, only to receive the below error.
 
GeorgeGiannakis_0-1637158530559.png

Can you please advise what I am missing here?

 

Kind regards,

 

George

 
 
1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

According to your description, do you want to show the results of the second screenshot without filtering the date as well? Why not try the ALLSELECTED function, which returns all values in all rows or columns of a table, ignoring any filters that may be applied inside the query and keeping only those from outside.

 

check the below video may wish to help you understand related function

ALL Vs ALLSELECTED Vs ALLEXCEPT DAX FIiter Functions | DAX Sundays Ep 5 - YouTube

 

Since I can't know your data model, I can't do any further testing. If the problem persists, can you provide the relevant test data (with sensitive information removed). I will answer for you as soon as possible.

 

Best Regards,
Henry


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

3 REPLIES 3
v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

According to your description, do you want to show the results of the second screenshot without filtering the date as well? Why not try the ALLSELECTED function, which returns all values in all rows or columns of a table, ignoring any filters that may be applied inside the query and keeping only those from outside.

 

check the below video may wish to help you understand related function

ALL Vs ALLSELECTED Vs ALLEXCEPT DAX FIiter Functions | DAX Sundays Ep 5 - YouTube

 

Since I can't know your data model, I can't do any further testing. If the problem persists, can you provide the relevant test data (with sensitive information removed). I will answer for you as soon as possible.

 

Best Regards,
Henry


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

amitchandak
Super User
Super User

@Anonymous , Try a measure  like

 

Diff-1_Pallets_All =
VAR LatestExtraction = CALCULATE(SUM(Shipments[Pallet_Num]),FILTER(ALL(Shipments) , Shipments[Index] = 1))
VAR PreviousExtraction = CALCULATE(SUM(Shipments[Pallet_Num]),FILTER(ALL(Shipments) ,Shipments[Index] = 2))
Return
LatestExtraction - PreviousExtraction

 

Or use index in all not date

Anonymous
Not applicable

Hello @amitchandak ,

 

Thank you for your reply.

 

I created the new measures as suggested.

 

GeorgeGiannakis_19-1637162958355.png

 

GeorgeGiannakis_20-1637162985384.png

 

Unfortunately, it didn't return the desired result.

 

ALL Visual

GeorgeGiannakis_17-1637162844112.png

 

Initial Visual (correct results)

GeorgeGiannakis_18-1637162881356.png

 

 

In case my initial post was not clear enough, I want to allow the interaction of all potential filters towards the Shipment table , apart from the extraction date.

 

The desired behaviour of the above visual is to always sum the quantity of the pallets of the most recent extraction (index = 1) and then calculate the differences versus the previous extraction (index = 2) and then, the one before that (index = 3).

 

Thank you,

 

George

 

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.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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