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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jamoroso
Helper I
Helper I

Calculation not working when adding a Column Sort

I am calculating the % of Originations based on the Loan Credit Score within the Category. It is working fine (left side below) until I add a column sort in. I added sorting the LoanCreditScore by the column CreditScoreRangeSortOrder and all the % Origination columns calculated to 100% (right side below). I cannot figure out how to get the % Origination calculation to work with the sorted column.

Measures:

Originations = CALCULATE(SUM('Loans'[LoanOriginalBalance]),DATESBETWEEN('Loans'[LoanOpenDate],SELECTED
VALUE('Date'[MonthBeginDate]),SELECTEDVALUE('Date'[MonthEndDate])))
 
% Originations = DIVIDE(Loans[Originations],CALCULATE(Loans[Originations],ALLSELECTED((Loans[LoanCreditScore]))))
 
(using 06/30/2023 as the MonthEndDate)

jamoroso_0-1691776978363.png  jamoroso_1-1691776992608.png

 

Date Data below 

 

Loan data and PBIX file: https://we.tl/t-awOXdcxiby

 

Thank you! 

--Janet

 

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Please find attached the PBI file.

Hope this helps.

Ashish_Mathur_0-1691898482966.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

Please find attached the PBI file.

Hope this helps.

Ashish_Mathur_0-1691898482966.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur 

Thank you so much!

 

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ThxAlot
Super User
Super User

There exists a side effect of Sort by Column functionality; this hidden pitfall impacts the calculation.

 

Refer to this article for details:

Side effects of the Sort By Column setting in DAX - SQLBI 



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



foodd
Super User
Super User

Please provide your work-in-progress Power BI Desktop file (with sensitive information removed) not as a screenshot.

https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

This allows members of the Forum to assess the state of the model, report layer, relationships, and any DAX applied.

jamoroso
Helper I
Helper I

Dates

DateKeyFullDateLatest Month EndMonthBeginDateMonthEndDateMonthEndDateKey
202301311/31/20231/31/20231/1/20231/31/202320230131
202302282/28/20232/28/20232/1/20232/28/202320230228
202303313/31/20233/31/20233/1/20233/31/202320230331
202304304/30/20234/30/20234/1/20234/30/202320230430
202305315/31/20235/31/20235/1/20235/31/202320230531
202306306/30/20236/30/20236/1/20236/30/202320230630

jamoroso_0-1691778806808.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.