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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

ONE Sales Data Table, TWO sumSALES Columns, TWO Date Slicers/Filters for each sumSales Column

Hello Community,

 

I am wondering how to apply the following logic in POWER BI:

 

I have a table with the sales fact data such as date, product, quantity, price, line amount and so on and a Calendar table which has a relationship with the sales table.

 

Therefore, I have a matrix/table, showing sold quantity per product and a date slicer.

Product nameSold Quantity
Product A10
Product Б20
Product C30
Product D40

 

So far so good!

 

I want to add a second column for sold quantity for a different period. The matrix should look like this:

 

Product nameSold Quantity Period 1Sold Quantity Period 2
Product A105
Product Б2015
Product C3025
Product D4035

 

There should be two date slicers:

- DATE SLICER PERIOD 1, filtering only column Sold Quantity Period 1

- DATE SLICER PERIOD 2, filtering only column Sold Quantity Period 2

 

I have tried parameters, variables and other techniques, described in PBI community knowledge base/forum, but with no results.

 

Thank you advance for your time.

 

Kind regards!

1 ACCEPTED SOLUTION

Hi @Anonymous ,

Based on my test, you could refer to below formula:

Measure = CALCULATE(MAX('Table2'[Sold Quantity]),FILTER('Table1','Table1'[Document Date] >=MINX('Calender',Calender[Date])&&'Table1'[Document Date] <=MAXX('Calender',Calender[Date])))
Measure2 = CALCULATE(MAX('Table2'[Sold Quantity]),FILTER('Table1','Table1'[Document Date] >=MINX('Calender2',Calender2[Date])&&'Table1'[Document Date] <=MAXX('Calender2',Calender2[Date])))

Pay attention that I have copied a calender table to show two time period:

1.PNG

Result:

2.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
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

3 REPLIES 3
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous ,

What is your date table looks like? Could you please offer your sample data and post your desired result if possible?

 

Regards,

Daniel He

Community Support Team _ Daniel He
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 @v-danhe-msft ,

 

the date table is a generic calendar table. Here is an example:

 

DateMonthNumMonthMonthLongQuarterYearFiscalMonthNumFiscalMonthFiscalMonthLongFiscalQuarterFiscalYearMonthYearNumMonthYearWeekdayWeekdayWeekendWeekSequenceNum
1.7.20157JulJulyQ320151JulJulyFQ1FY16201507Jul-15WedWeekday27
2.7.20157JulJulyQ320151JulJulyFQ1FY16201507Jul-15ThuWeekday27
5.7.20157JulJulyQ320151JulJulyFQ1FY16201507Jul-15SunWeekday28

 

Sales Data Table looks like:

 

Product IDQuantityStore IDDocument NoDocument Date
15110000000011.7.2015
210110000000012.7.2015
315110000000013.7.2015
420110000000014.7.2015

 

Relationship is between both tables done through columns Calendar.Date & SalesData.DocumentDate

 

As a result I expect the following:

 

Filters  
Period 1:1.01.2015 - 02.07.2015 
Period 2:3.01.2015 - 04.07.2015 
   
Product IDSOLD Quantity Period 1Sold Quantity Period 2
150
2100
3015
4020

 

Actually, the abovementioned periods are used for illustrating the desired effect but they would not be so short in reality.

 

Kind regards,

 

Hi @Anonymous ,

Based on my test, you could refer to below formula:

Measure = CALCULATE(MAX('Table2'[Sold Quantity]),FILTER('Table1','Table1'[Document Date] >=MINX('Calender',Calender[Date])&&'Table1'[Document Date] <=MAXX('Calender',Calender[Date])))
Measure2 = CALCULATE(MAX('Table2'[Sold Quantity]),FILTER('Table1','Table1'[Document Date] >=MINX('Calender2',Calender2[Date])&&'Table1'[Document Date] <=MAXX('Calender2',Calender2[Date])))

Pay attention that I have copied a calender table to show two time period:

1.PNG

Result:

2.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.