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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Syndicate_Admin
Administrator
Administrator

all() stops working if I sort one column based on another

From a column with the year, which today goes from 1980 to 2009 -although in the future it will start in 1960-, I have created two others with the decade, one of whole type, decada, (1980, 1990, 2000) and another of text type, decada_texto (80s, 90s, 00s). For the purposes of the problem that I am going to comment on below, it does not matter if I create them from Power Query or as calculated columns.

PowerBI orders decada_texto such that "00s -> 80s -> 90s", so I have ordered it according to decade, which being an integer does not suffer from this type of problems, so that the order is "80s -> 90s -> 00s".

Well, the problem is that doing this raises a problem with ALL(); if we count the number of different decades that exist and tell you not to take into account the filter context for the decada_texto itself:

decadas = CALCULATE(DISTINCTCOUNT(listas_spotify[decada_texto]), ALL(listas_spotify[decada_texto]))

Here's the result:

ALL() has no effect.

If you "disengage" decada_texto of a decade (note that the order is again "00s -> 80s -> 90s"):

Dph8b.png

ALL() is back to normal operation.

What way is there to solve this while maintaining the order I want?

Greetings and thanks in advance.

1 ACCEPTED SOLUTION
bcdobbs
Community Champion
Community Champion

I think if you add a second ALL referring to your sort column it will fix it. The sort column is added into the filter context at the same time as the main column.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

View solution in original post

1 REPLY 1
bcdobbs
Community Champion
Community Champion

I think if you add a second ALL referring to your sort column it will fix it. The sort column is added into the filter context at the same time as the main column.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors