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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
DominicDao
New Member

Sum Value of specified product base of date filter of slicer

Dear All,

Please help me on this.

I had 02 tables: 1 is Product Table (unique value of Product Name) and 1 is Sales Table (with Date of Sales, Product Name (repeated by Dates of Sales) and Quantity of Sales.

I want to create a measure that when i filter Date Slicer in Bi report, Product Tables will show Sum of Qty for each Product within the dates that I selected.

Example as below:

Sales table  
   
Dates of SalesProductQty
   
8/1/2023A10
8/2/2023B5
8/3/2023C2
8/4/2023A2
8/2/2023D1
7/1/2023B4
7/5/2023C2
8/6/2023A3

 

Result should be as below:

 StartEnd  
Slicer Filter7/5/20238/3/2023-> this is slicer from report
     
Product Table    
     
ProductQty   
     
A10   
B5   
C4   
D1   

Appreciated your help so much.

Dominic

1 ACCEPTED SOLUTION

@DominicDao 
You may try this measure

Count =
SUMX (
    VALUES ( 'Product'[Product] ),
    INT ( CALCULATE ( SUM ( Sales[Qty] ) ) > 0 )
)

View solution in original post

6 REPLIES 6
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your datamodel looks like, but one of ways to solve this is to create a datamodel that has good relationships, something like below.

 

Jihwan_Kim_0-1692242810129.png

 

Jihwan_Kim_1-1692242876420.png

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thanks for your ideas. Please allow me to explain clearer, i dont want the result to show in report, just want to create a measure in column Qty of Table Product, get the result of Table Sales base on filter of Date Slicer in report.

DominicDao_0-1692245500990.png

 

Warm Regards,

Hi @DominicDao 
Calculated Columns and calculated tables do not interact with the filter context. A calculated column is evaluated only once and won't change with slicer selection. This has to be a measure in the report. It seems to me that you need to use the quantity to do some sort of dynamic segmentation? If this is true please provide more details of what exactly are you trying to accomplish.

Hi @tamerj1 ,

With above intention, I planned to get value of products and use formula to assign that if value = 0, count as 0 and value >0, count as 1. Finally, the card will be measure that Sum of column that contain assignment.

Sorry, i am new to BI and learn myself so it will be very manually calculation.

Best Regards,

 

@DominicDao 
You may try this measure

Count =
SUMX (
    VALUES ( 'Product'[Product] ),
    INT ( CALCULATE ( SUM ( Sales[Qty] ) ) > 0 )
)

Hi tamerj1,

 

Thanks so much. It worked for me.

 

Warm Regards,

Dom

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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