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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

ALLSELECTED function usage

found a great tutorial on the SQL BI website that shows the differences between the options of using the ALLSELECTED function.

The first table on this page is what I'd like to reproduce in my Power BI Desktop. You can find it here: https://www.sqlbi.com/articles/the-definitive-guide-to-allselected/

I'm using a similar dataset from Microsoft, which is available here: https://github.com/microsoft/powerbi-desktop-samples/blob/main/Sample%20Reports/Sales%20%26%20Return...

I've defined the measures in very similar ways, but the ALLSELECTED function doesn't give me good results.

 

m_Sales_Amount = 
SUMX(
    Sales, 
    Sales[Unit] * Sales[Amount]
)

m_AllSelectedColumn = 
CALCULATE(
    [m_Sales_Amount],
    ALLSELECTED('Customer'[Category])
    )

m_AllSelectedTable = 
CALCULATE (
    [m_Sales_Amount],
    ALLSELECTED ( 'Customer' )
)

m_AllSelectedAll = 
CALCULATE (
    [m_Sales_Amount],
    ALLSELECTED ()
)

 

 

 

abanar_3-1698669904344.png

I'm using the Matrix visual with rows from the Customer table.

 
Here's a screenshot of my data model:
abanar_1-1698669689619.png

 

2 REPLIES 2
MFelix
Super User
Super User

Hi @Anonymous ,

 

Believe that the difference between your example and the one for SQL BI is that they are using values from two different tables:

MFelix_0-1698759589869.png

And in you case the calculations comes from the same table so they have the same result.

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Yes, you are right. I found another dataset under another blog post which contains the good one. 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.