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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
tharris
Frequent Visitor

Measure changing result when switching from localhost SASS model to live server connection

Hello Community,

 

I have a measure that calculates how many of my vendors make up 80% of my spend. It works perfectly when I am connected through localhost (that's how I created it and tested it), but when I switch to live connection to the server (same model and same environment), that number changes.

 

My measure is as follows:

 

# of Suppliers for 80% of Spend =
VAR temp = SUMMARIZE(Vendor,Vendor[VEND_ID],"% Spend", [% of Total Amount Spend])
VAR temp1 = ADDCOLUMNS(temp,"RANK",RANKX(temp, [% Spend],,DESC,Dense))
VAR temp2 = ADDCOLUMNS(temp1, "Cumulative",SUMX(filter(temp1,[RANK] <= EARLIER([RANK])), [% Spend]))
RETURN
MINX(filter(temp2,[Cumulative]>.8),[RANK])
 
and 
% of Total Amount Spend = DIVIDE(sum('Purchase Order'[PO_LN_PO_LN_TOT_AMT]),calculate(sum('Purchase Order'[PO_LN_PO_LN_TOT_AMT]),ALLEXCEPT('Purchase Order','Purchase Order'[PO_LN_PO_LN_TOT_AMT])))
 
The ecxpected result is 266. I have validated that in many ways. When I switch from localhost to live connect, the result changes to 1 😞 
 
I know some functions will work on localhost, but not live connect, such as distinctcountnoblank... I had another measure I had to modify because of that, but all functions within my measure seems to work on the live server connection, so I can't figure out what is causing this.
 
Please help!
 
Thanks!

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

If I had to guess, it is EARLIER. It is not on the list of supported DAX functions for your scenario:

 

https://docs.microsoft.com/en-us/analysis-services/tabular-models/dax-formula-compatibility-in-direc...

 

Try this:

VAR temp = SUMMARIZE(Vendor,Vendor[VEND_ID],"% Spend", [% of Total Amount Spend])
VAR temp1 = ADDCOLUMNS(temp,"RANK",RANKX(temp, [% Spend],,DESC,Dense))
VAR temp2 = ADDCOLUMNS(temp1, "Cumulative",VAR __Rank = MAX([RANK]) RETURN SUMX(filter(temp1,[RANK] <= __Rank)), [% Spend]))
RETURN
MINX(filter(temp2,[Cumulative]>.8),[RANK])

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

If I had to guess, it is EARLIER. It is not on the list of supported DAX functions for your scenario:

 

https://docs.microsoft.com/en-us/analysis-services/tabular-models/dax-formula-compatibility-in-direc...

 

Try this:

VAR temp = SUMMARIZE(Vendor,Vendor[VEND_ID],"% Spend", [% of Total Amount Spend])
VAR temp1 = ADDCOLUMNS(temp,"RANK",RANKX(temp, [% Spend],,DESC,Dense))
VAR temp2 = ADDCOLUMNS(temp1, "Cumulative",VAR __Rank = MAX([RANK]) RETURN SUMX(filter(temp1,[RANK] <= __Rank)), [% Spend]))
RETURN
MINX(filter(temp2,[Cumulative]>.8),[RANK])

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

thank you a bunch! It worked!!!

 

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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