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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join 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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.