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
joannageorge
Frequent Visitor

Trying to calculate sales volume using CALCULATE, but it gives me error

Hi guys, I am trying to calculate the sales volume of a few customers below, and filtered by Sales Method.
This is my dax code but it gives me an error : "The True/False expression does not specify a column. Each True/False expressions used as a table filter expression must refer to exactly one column."
 
What is going on? how can i fix this? 
 
Eligible Vol v2 =

 

VAR CA_vol =
CALCULATE (SUM ( [Shipped Quantity in MFBM] ), Customer[Sold To Customer Group Name] = "GROUPE BMR GROUP",
Sales[Sales Method] = "CA")
 
VAR all_vol =
CALCULATE (SUM ( [Shipped Quantity in MFBM] ), Customer[Sold To Customer Group Name] = "HOME DEPOT GROUP" || "LOWE'S GROUP" || "ADVANCE GROUP")
 
VAR CT_vol =
CALCULATE (SUM ( [Shipped Quantity in MFBM] ),Customer[Sold To Customer Group Name] = "MENARDS GROUP"|| "84 LUMBER GROUP" || "BUILDERS FIRSTSOURCE GROUP" || "JOES LUMBER" || "DO IT BEST GROUP" || "LBM ADVANTAGE GROUP" || "LMC GROUP" || "US LBM GROUP" || "DOMAN BUILDING MATERIALS GROUP LTD." || "LOUISIANA-PACIFIC GROUP" || "STANDARD BUILDING SUPPLIES GROUP" || "UFP PURCHASING, INC. GROUP" || "WELCO GROUP" || "WOODTONE GROUP" || "CANADIAN ENGINEERING GROUP" || "MILLMAN GROUP", Sales[Sales Method] = "CT")
 
RETURN
   CALCULATE (SUM ( [Shipped Quantity in MFBM] ), CA_vol, all_vol, CT_vol)
4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Share some data, describe the question and show the expected result.


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

Hi Ashish, I've sent you a DM because some data may be sensitive. Could you kindly please check your inbox?

OwenAuger
Super User
Super User

Hi @joannageorge 

Just a small tweak needed.

Column = A || B || C isn't correct syntax for what you are wanting to do.

Instead, one way to write your Sold To Customer Group Name conditions is this (using the CA_vol example):

 

Customer[Sold To Customer Group Name] IN { "HOME DEPOT GROUP", "LOWE'S GROUP", "ADVANCE GROUP" }

 

 

You can also write it this way, but I would recommend the first option.

 

Customer[Sold To Customer Group Name] = "HOME DEPOT GROUP" || Customer[Sold To Customer Group Name] = "LOWE'S GROUP" || Customer[Sold To Customer Group Name] = "ADVANCE GROUP"

 

 

Also, for your final RETURN statement, I think you want this, which is the sum of the three variables defined earlier:

 

RETURN
    CA_vol + all_vol + CT_vol

 

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Hi Owen, 

Thank you for your reply. I tried both methods, but it doesnt seem to work and is still returning the same error.

 

For the RETURN part, if I sum them all up, like you did above, it shows one value for all customers (example: 1,7000,200) 

 

Any other ideas? 

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.