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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

Sort by Column function influence measure result

Hi All.

Ok, so this is the strangest one, which I came across so far.

First, let me describe the part, which is understable.

 

I have a simple model, which contains one fact table and one dimension table with Account.

KamilSzpyrka_0-1633079871344.pngKamilSzpyrka_1-1633079886992.png

 

Then I've created a measure, which calculates sum of column value for account ZwykleKonto1

 

Measure = CALCULATE(sum(factFact[Value]), dimAccount[Account] = "ZwykleKonto1")
 
When I create a table visual with Account and Measure it looks like below, which is completly reasonable to me (measure filter overwrites context filter).
KamilSzpyrka_2-1633079997362.png

 

Now let's start with the mistic part. When I sort column Account by column Sorter, Measure starts to reflect 0 for Accounts with different Sorter value then 50 (which is value for ZwykleKonto1). I completly do not understand this behavious. Can I ask for explanation please?

 

KamilSzpyrka_3-1633080040962.pngKamilSzpyrka_4-1633080150337.png

 

 

 

Many Thanks, Kamil.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

2 REPLIES 2
Anonymous
Not applicable

After some research I found an article describing this behaviour.

 

https://blog.crossjoin.co.uk/2015/12/15/power-bi-desktop-sort-by-column-and-dax-calculations-that-us...

amitchandak
Super User
Super User

@Anonymous , Try like

Measure = CALCULATE(sum(factFact[Value]),filter( dimAccount, dimAccount[Account] = "ZwykleKonto1"))

 

refer

http://dataap.org/blog/2019/04/22/difference-between-calculate-with-and-without-filter-expression/

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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