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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

ALLSELECTED ignoring page level filters

Hi All,

I am having a problem doing something in Power BI that should be quite easy but is proving to be quite difficult.  Here is the setup:

  • The datatables are TableA (which contains [Mill Number]) -> TableB (which contains [Population Number]) -> TableC (which contains [Report Period Date] -> TableD, which contains the data in the table object as follows:
    • TableD[Load Table]
    • TableD[Sample Weight]
    • TableD[Net Scale]
    • New Column[Est Scale] = TableD[Sample Weight] / New Column[colRatio]
    • New Column[Diff] = TableD[Net Scale] - New Column[Est Scale]
    • New Column[colRatio] = CALCULATE([Ratio], ALLSELECTED(TableD)) - I have to do this with a CALCULATE function because if I use [Ratio] directly, I get a circular error.
  • The following measure has also been created:
    • Ratio = SUM(TableD[Sample Weight]) / SUM(TableD[Net Scale]) = 821.112

jhasell_0-1638556836650.png

The colRatio column does not match the Ratio measure, which means the Est Scale column is incorrect.  Analysis shows that the number colRatio does display (800.903) is the correct result if there were no page level filters.

 

Am I using the ALLSELECTED method correctly?  How do I set the colRatio column to the Ratio measure value, or at least recreate the calculation that make the Ratio measure value for each row in the colRatio column?

 

Any help would be appreciated and if you need any more information, I would be happy to provide it.  Thanks.

1 ACCEPTED SOLUTION

Sorry, it isn't very clear what these calculations are supposed to represent, so it's a bit like shooting in the dark.

 

This might be what you're looking for but I can't really tell from the information provided:

Est Scale =
DIVIDE (
    SUM ( TableD[Sample Weight] ),
    CALCULATE ( [Ratio], ALLSELECTED ( TableD ) )
)

View solution in original post

8 REPLIES 8
AlexisOlson
Super User
Super User

ALLSELECTED is not as simple as it might seem at first. Read this for the gory details:
https://www.sqlbi.com/articles/the-definitive-guide-to-allselected/

 

That said, your issue might simply be that you're expecting a calculated column to be sensitive to report filters. Calculated columns cannot be dynamically responsive to user interaction via slicers and filters since it's only computed once each time your data model is first loaded or refreshed, not in response to what the user is doing. Measures, on the other hand, are intended to be dynamically responsive.

Anonymous
Not applicable

So is there any way I can get a calculated column to be dynamically responsive?

No. For the reasons I pointed out, this is fundamentally impossible.

 

However, measures are meant to be dynamic and I don't see any reason why a measure wouldn't work just as well as a calculated column for your visual.

Anonymous
Not applicable

The Est Scale column is the row value Sample Weight divided by the measure Ratio.  Is there a way to use a calculated value in each row without using a new column?

That can be a measure too. See if this works:

Est Scale = SUM ( TableD[Sample Weight] ) / [Ratio]
Anonymous
Not applicable

Unfortunately, that returns a value as if that row was the only row in the table.  Same thing as if I use a SUMX(TableD, TableD[Sample Weight]) / [Ratio].

Sorry, it isn't very clear what these calculations are supposed to represent, so it's a bit like shooting in the dark.

 

This might be what you're looking for but I can't really tell from the information provided:

Est Scale =
DIVIDE (
    SUM ( TableD[Sample Weight] ),
    CALCULATE ( [Ratio], ALLSELECTED ( TableD ) )
)
Anonymous
Not applicable

Thanks.  That worked.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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