Join 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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hello all,
I have a powerbi report below, that is very simple that consists of two columns: Quantity and Date.
I have one relationship between Sales and Date, on Date column.
I want to calculate two measures. First, Sales Amount.
When I select the first 13 days of February, it gives me the wrong result in grand total. But if I select the first 12 days of February, it gives me correct grand total.
Solved! Go to Solution.
Hi @hcirak
please try
Previous Month Same Period =
SUMX (
VALUES ( 'Date'[Date] ),
CALCULATE (
VAR LDS =
LASTNONBLANK ( 'Date'[Date], Sales[Sales Amount] )
VAR CR =
DATESBETWEEN ( 'Date'[Date], MIN ( 'Date'[Date] ), LDS )
VAR PR =
DATEADD ( CR, -1, MONTH )
RETURN
IF ( LDS >= MIN ( 'Date'[Date] ), CALCULATE ( Sales[Sales Amount], PR ) )
)
)
Hi @hcirak
please try
Previous Month Same Period =
SUMX (
VALUES ( 'Date'[Date] ),
CALCULATE (
VAR LDS =
LASTNONBLANK ( 'Date'[Date], Sales[Sales Amount] )
VAR CR =
DATESBETWEEN ( 'Date'[Date], MIN ( 'Date'[Date] ), LDS )
VAR PR =
DATEADD ( CR, -1, MONTH )
RETURN
IF ( LDS >= MIN ( 'Date'[Date] ), CALCULATE ( Sales[Sales Amount], PR ) )
)
)