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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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])

 


@ 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!:
The Definitive Guide to Power Query (M)

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])

 


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

thank you a bunch! It worked!!!

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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