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

% Grand Total using barcode scanner

I have a report that is working great with the barcode scanner...but my calculation for % Grand Total doesn't work when the product is scanned, only when it is selected from a table or other visual on the page.  When scanned, it only calculates based off the products that have been scanned, not the entire dataset.   

 

Here is my calculation:

 

% Grand Total of Volume = DIVIDE(SUM(SUB_SETTLED_SALES[VV998_Q_PHYSICAL_CASES]) ,
 (CALCULATE(SUM(SUB_SETTLED_SALES[VV998_Q_PHYSICAL_CASES]),                               allselected(BAS_MDM_UNITED_CUSTOMER[CUSTOMER_ID]), ALL(BAS_MDM_UNITED_PRODUCT)) ))
1 ACCEPTED SOLUTION
Kmptrgeek
Frequent Visitor

I think I have solved my issue.  In the DAX I've written I am filtering by all selected customers and all products.  When I modified my DAX to be the following it looks like the calculations are working with the scanner.  

 

% Grand Total of Volume = DIVIDE(SUM(SUB_SETTLED_SALES[VV998_Q_PHYSICAL_CASES]) ,
 (CALCULATE(SUM(SUB_SETTLED_SALES[VV998_Q_PHYSICAL_CASES]), ALL()) ))
 
Now I just have to figure out why my RANKX code isn't working with the scanner.  🙂

View solution in original post

5 REPLIES 5
Kmptrgeek
Frequent Visitor

I think I have solved my issue.  In the DAX I've written I am filtering by all selected customers and all products.  When I modified my DAX to be the following it looks like the calculations are working with the scanner.  

 

% Grand Total of Volume = DIVIDE(SUM(SUB_SETTLED_SALES[VV998_Q_PHYSICAL_CASES]) ,
 (CALCULATE(SUM(SUB_SETTLED_SALES[VV998_Q_PHYSICAL_CASES]), ALL()) ))
 
Now I just have to figure out why my RANKX code isn't working with the scanner.  🙂
v-jianboli-msft
Community Support
Community Support

Hi @Kmptrgeek ,

 

When you scanned, the visuals will be filtered by the product barcode you scanned.

What is the % Grand Total calculated and does it vary depending on the item scanned? Or it is a fixed value?

You can try to use some filter functions like REMOVEFILTERS() to remove the Barcode's filter.

If that does not work, please provide me with more details about your table and the relationships between your tables or share me with your pbix file after removing sensitive data.

 

Here are some Documnents, please check if these could help you a little:

Filter functions (DAX) - DAX | Microsoft Docs

REMOVEFILTERS function (DAX) - DAX | Microsoft Docs

 

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

The REMOVEFILTERS command will not work in my case because I'm am accessing the tables via Direct Connection.  I understand how the barcode scanning functionality works as far as filtering the visuals, I just don't understand how to write the DAX to get it to apply my calculation to the entire dataset instead of just what was scanned.  This DAX works when I filter to a specific product:

 

% Grand Total of Volume = DIVIDE(SUM(SUB_SETTLED_SALES[VV998_Q_PHYSICAL_CASES]) ,
 (CALCULATE(SUM(SUB_SETTLED_SALES[VV998_Q_PHYSICAL_CASES]),                               allselected(BAS_MDM_UNITED_CUSTOMER[CUSTOMER_ID]), ALL(BAS_MDM_UNITED_PRODUCT)) ))
 
My pbix file is massive and will take forever to remove the sensitive data.  This "seems" pretty straightforward to me as far as what the issue is.  It has nothing to do with the table schemas or anything like that...it's the DAX.  Why is it working with the filters in the report but not with the barcode scanner?
 
Thank you for any assistance.
v-jianboli-msft
Community Support
Community Support

Hi @Kmptrgeek ,

 

Sorry for that the information you have provided is not making the problem clear to me. Can you please share more details to help us clarify your scenario?

Please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I have a report that has product information on it (first order date, number of orders, etc.) and one of the metrics is percent of grand total.  All of these metrics works correctly when the product is selected from a list of products (or filter)...but when a product is scanned using the barcode scanning capability, the percent of grand total calculation only uses the scanned product, not the entire dataset.  

 

Does that make more sense?

 

BR CAF FREE COKE.png

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.