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
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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors