cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Beehive Frequent Visitor
Frequent Visitor

Column totals sumx and Hasonefilter in DAX

Hi All,

 

I have researched the solution on different threads to calculate the correct answer for summing columns that include a row of calculated measures but continue to get an error with the Filter in Sumx as follows.  Can someone please assist?

 

 

Price variance Amount CY LY = if(HASONEFILTER

(viewAllSalesTransactions[ItemName]), if(calculate([Total Sales LY])>0,(CALCULATE([Average Sales Price CY])-CALCULATE([Average Sales Price LY]))*CALCULATE([Total Quantity CY]),0),

 

sumx( FILTER('viewAllSalesTransactions','viewAllSalesTransactions'[Total Sales LY] > 0,('viewAllSalesTransactions'[Average Sales Price CY]-'viewAllSalesTransactions'[Average Sales Price LY])*'viewAllSalesTransactions'[Total Quantity CY])))

 

Error message:

Too many arguments were passed to the FILTER function. The maximum argument count for the function is 2.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Column totals sumx and Hasonefilter in DAX

Hi,

 

Try this

 

=SUMX(FILTER(SUMMARIZE(VALUES(Data[Product]),[Product],"ABCD",[Average Sales Price CY],"EFGH",[Average Sales Price LY]),[EFGH]>0),([ABCD]-[EFGH])*[Total Quantity CY])

 

Hope this helps.


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

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Column totals sumx and Hasonefilter in DAX

Hi,

 

Share a dataset and also show the expected result.


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

Re: Column totals sumx and Hasonefilter in DAX

I hope the following makes sense.  The expected outcome is in red text, however, without the Sumx the measure will calculate 35 for the column total ie. (13.33 - 11) * 15 = 35

 

1CDEFGHIJKL
2 Total Sale CYTotal Sales LYSales Amount Variance CY LYAverage Sales Price CYAverage Sales Price LYPrice Variance Amount CY LY Price Variance Amount CY LY (Formula)Total Quantity CYTotal Quantity LY
3Product A100110-101011-10=IF(H7>0,+(G7-H7)*K7,0)1010
4Product B100 1002000=IF(H8>0,+(g8-h8)*K8,0)50
5Total20011090        13.33        11.00-10 1510
Super User
Super User

Re: Column totals sumx and Hasonefilter in DAX

Hi,

 

Try this

 

=SUMX(FILTER(SUMMARIZE(VALUES(Data[Product]),[Product],"ABCD",[Average Sales Price CY],"EFGH",[Average Sales Price LY]),[EFGH]>0),([ABCD]-[EFGH])*[Total Quantity CY])

 

Hope this helps.


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

View solution in original post

Helpful resources

Announcements
October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Badges

Incoming: New and Improved Badges

Exciting news: We've given our badges an overhaul and added brand news ones.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 6 members 1,833 guests
Please welcome our newest community members: