Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hello everyone.
I have a Date table called Dim_Date2 and it doesn't connected to my Fact table Sales for others reasons. So, I have to filter date in each measure.
I have the next measure to calculate Sales and Previous Sales:
Sales:=CALCULATE(SUM(Fact_Sales[SalesAmount]), FILTER(Fact_Sales,Fact_Sales[SalesDate]>=[MinimumDate]&&Fact_Sales[SalesDate]<=[MaximumDate]))
Previous Sales:=CALCULATE(Fact_Sales[Sales],DATEADD(Dim_Date2[Date],-[SelectedDays],DAY))
MaximumDate:MAX(Dim_Date2[Date])
MinimumDate:MIN(Dim_Date2[Date])
SelectedDays:CALCULATE(DISTINCTCOUNT(Fact_Sales[KeySalesDate]),FILTER(Fact_Sales,Fact_Sales[SalesDate]>=[MinimumDate]&&Fact_Sales[SalesDate]<=[MaximumDate]))
And the variation is the subtraction of both.
Previous Sales measure works if I select an specific date, but if I select the same date with a Year, month and day... it doesn't work .
I hope you can help me.
Hi
You can try: dateadd(LASTDATE(Dim_Date2[Date]),-1,day)
Previous Sales = calculate([Sales],dateadd(LASTDATE(Dim_Date2[Date]),-1,day))
If I answer your question, please mark my post as a solution, this will also help others.
Please give Kudos for support.
Tomas Santandreu Polanco |Principal Business Intelligence Consultant
www.designmind.com
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
6 | |
3 | |
3 | |
3 |
User | Count |
---|---|
11 | |
9 | |
8 | |
8 | |
7 |