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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
radissoufan
New Member

power bi function ALL strange behavior

Hello,
I have single simple DAX

Measure 2 = CALCULATE(
    COUNTA(Query1[target_lfs_agg.f_m_id]),
            ALL(Query1[target_lfs_agg.age_group])
                )

radissoufan_0-1754228368399.png

the result is still filterd by the field,, why?.. isn't suppose to be all the same value? the strange is working correctly on naumbers types

radissoufan_1-1754228560672.png

 

7 REPLIES 7
v-pnaroju-msft
Community Support
Community Support

Thank you @FBergamaschi , @mdaatifraza5556 , and @AmiraBedh  for your responses.

Hi radissoufan,

Thank you for your update and for sharing your insights and approach to resolving the issue. Kindly continue to utilise the Fabric Community for any further assistance with your queries.

Thank you.

AmiraBedh
Super User
Super User

Hello !

Thank you for posting on Fabric community.

I think that the issue is about how Power BI is treating target_lfs_agg.age_group as a text column that is not truly disconnected from context.  When you use ALL(Query1[target_lfs_agg.age_group]) thisis removes the filter only on that column. Power BI re-applies the visual-level context to show a bar per category even though the measure ignores the filter from the column itself.

Your second visualuses target_lfs_agg.age_group_id which is numeric, (I assumed that you use it as a surrogate key) and because it's an integer and doesn’t carry any internal display logic or metadata (like formatted labels), Power BI doesn’t re-apply as much context automatically, especially if it's not used elsewhere in visuals or sorting.

So you should try :

Measure 2 = 
CALCULATE(
    COUNTA(Query1[target_lfs_agg.f_m_id]),
    REMOVEFILTERS(Query1[target_lfs_agg.age_group])
)

or Measure 2 = 
CALCULATE(
    COUNTA(Query1[target_lfs_agg.f_m_id]),
    ALL(Query1)
)

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
radissoufan
New Member

first one is

Measure 2 = CALCULATE(
    COUNTA(Query1[target_lfs_agg.f_m_id]),
            ALL(Query1[target_lfs_agg.age_group])
                )
second one is

Measure 2 = CALCULATE(
    COUNTA(Query1[target_lfs_agg.f_m_id]),
            ALL(Query1[target_lfs_agg.age_group_id])
                )

the strange thing is that the result of the first image finally gave me a correct result when i included the (id) column which i used in sorting the description column with the all() function 

Measure 2 = CALCULATE(
    COUNTA(Query1[target_lfs_agg.f_m_id]),
            ALL(Query1[target_lfs_agg.age_group]),
            ALL(Query1[target_lfs_agg.age_group_id])
                )

OK now I got it

 

Whenever you sort a column by abohter one, you inject an additional filter that you were not removing

 

So, to get the behaviour you want

 

CALCULATE(
    COUNTA(Query1[target_lfs_agg.f_m_id]),
            ALL(Query1[target_lfs_agg.age_group]),
            ALL(Query1[target_lfs_agg.age_group_id])
)
 
This is true only beacuse you sorted the age_group by age_group_id and it is true only in Power BI and not in Power Pivot where your original code would have worked correctly
 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

If my post solved and clarified, pls mark it as a solution so others can benefit from it (or mark somebody else's reply as such)

 

Thanks

mdaatifraza5556
Super User
Super User

Hi @radissoufan 

I have tried with a sample dataset.

It's working fine.
Could you please share the PBIX file or the sample dataset?

Below is what I have tried.

Result = CALCULATE(
    COUNTA('Table'[f_m_id]),
    ALL('Table'[age_group])
)
 
 

Screenshot 2025-08-03 193214.png

 

I have also attached the pbix file you check it.


 



If this answers your questions, kindly accept it as a solution and give kudos.

FBergamaschi
Solution Sage
Solution Sage

You show two images

 

Can you please write here

 

The code executed in each and  what is the column grouped in the ROWS section in each?

 

ALL as a CALCULATE modifier removes filters so you should see the same value but that depends on which is the column on ehich you remove the filters vs which is the column you are grouping in ROWS

 

The behoaviour in the firts image seems incorrect at first glance, so please can you share the pbix via some cloud service

 

Thx

 

 

 

If this helped, please consider giving kudos and mark as a solution

@mein replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.