The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 ) )
)
)
User | Count |
---|---|
11 | |
9 | |
6 | |
6 | |
5 |
User | Count |
---|---|
24 | |
14 | |
14 | |
9 | |
7 |