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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Calculate Metric Value and Offset Date while keeping real value

Hello,

 

I have a table of registered sales # with dates on which the sales were made. And I have a calendar table attached to it. This way I get a chart with growth of sales per day. However I want to see comparison between periods. For that I made two more Calendar tables and then I calculate Sales with USERELATIONSHIP on either Current Calendar or Previous Calendar. Both Current and Previous Calendars have filter slicers so you can compare whatever period with whichever.

 

My goal is to have a chart with X axis of Current Calendar (Y for sales amount) and have both Current and Previous sales on the same timeline, by offseting the Previous Calendar MIN(date) to match Current Calendar's. That way if I select to measure 2019/03/01-2019/03/07 period with 2019/02/21-2019/02/27 I get different Sales lines on the same timeline. The idea is that Previous start date matches the date of current start. And if it is longer then the timeline extends, but Current Sales line ends before Previous Sales line.

 

The problem is that I do not know how to Calculate Previous Sales and after that Offset their Real Dates to those of Current Dates, keeping their real values. 

2 REPLIES 2
TeigeGao
Solution Sage
Solution Sage

Hi LukasUM,

According to your description, my understanding is that you want to display two value on the same X axis based on the data slicer, in this scenario, we can use the following steps:

Create two calendar table and create single relationship to the data table, and then create the following two measure:

Measure1 = CALCULATE(SUM(Data[Data]),FILTER(ALL(Data),Data[Date] >= MIN(calender1[Date]) && Data[Date] <= MAX(calender1[Date])))
Measure2 = CALCULATE(SUM(Data[Data]),FILTER(ALL(Data),Data[Date] >= MIN(calender2[Date]) && Data[Date] <= MAX(calender2[Date])))

The result will like below:

aaaa.png

Best Regards,

Teige

Anonymous
Not applicable

That's the first step that I had already done. But now I want X axis to display Calendar1 filtered data, while data from Calendar2 show up on the same days using day1 as a starting point

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors