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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
IrekK
Regular Visitor

A measure that calculates sales based on a table with bonuses

Hi, I can't figure out a metric that will calculate the sold quantity of the products I have in the "Bonus Products" table.
The bonus products table contains articles that are selected in monthly cycles, but it happens that the action for a given product may last several days. Hence the Start and End date.
In addition, it may happen that the same product in one week of the month may be priced at $10 and the next week its price will be $15.
Too difficult a task for my strength.
Help me find a solution, hints.
Thank you in advance

 

IrekK_0-1672864642372.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @IrekK 

Based on my understanding of the information you have provided , I create a measure to calculate total quantities

Total_salequantity = var _startdate=DATE(MAX(BONUS[Year]),MAX(BONUS[Month]),RIGHT(MAX(BONUS[DimDateStart]),2))
var _enddate=DATE(MAX(BONUS[Year]),MAX(BONUS[Month]),RIGHT(MAX(BONUS[DimDateEnd]),2))
return CALCULATE(SUM(SALES[Quantity]),DATESBETWEEN('CALENDAR'[Date],_startdate,_enddate))

and I change the cross filter between Bonus table and Article table to 'Both'

vxinruzhumsft_0-1673338566578.png

 

Output:

vxinruzhumsft_1-1673338585828.png

If the information above cannot meet your requirement, can you provide more information? such as What  do you want to calculate, total sales or toal quantities. from the information you have offered, you want to calculate total quantities.

 

Best Regards!

Yolo Zhu

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

 

View solution in original post

5 REPLIES 5
IrekK
Regular Visitor

Hi, finally I was able to put the file in onedrive.

 

https://1drv.ms/u/s!AvSMwqcJvxJvgZQEctRS-wtP5iO0pA?e=bMm4l4

 

 

Anonymous
Not applicable

Hi @IrekK 

Based on my understanding of the information you have provided , I create a measure to calculate total quantities

Total_salequantity = var _startdate=DATE(MAX(BONUS[Year]),MAX(BONUS[Month]),RIGHT(MAX(BONUS[DimDateStart]),2))
var _enddate=DATE(MAX(BONUS[Year]),MAX(BONUS[Month]),RIGHT(MAX(BONUS[DimDateEnd]),2))
return CALCULATE(SUM(SALES[Quantity]),DATESBETWEEN('CALENDAR'[Date],_startdate,_enddate))

and I change the cross filter between Bonus table and Article table to 'Both'

vxinruzhumsft_0-1673338566578.png

 

Output:

vxinruzhumsft_1-1673338585828.png

If the information above cannot meet your requirement, can you provide more information? such as What  do you want to calculate, total sales or toal quantities. from the information you have offered, you want to calculate total quantities.

 

Best Regards!

Yolo Zhu

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

 

IrekK
Regular Visitor

hello Yolo Zhu, thanks for your willingness to help. please write in what form I can post sample data here, generally I have a sample prepared in pbx.

Anonymous
Not applicable

Hi @IrekK 

You can provide picture of sample data or you can put your pbix file to your onedrive, then share the link here.

 

Best Regards!

Yolo Zhu

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

 

Anonymous
Not applicable

Hi @IrekK 

Based on the information i have got, i make a flow chart you can refer to

vxinruzhumsft_0-1672883237687.png

and can you provide some sample data that i can provide more solution for you.

 

Best Regards!

Yolo Zhu

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

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.