The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 |
---|---|
26 | |
10 | |
8 | |
6 | |
6 |
User | Count |
---|---|
31 | |
12 | |
10 | |
10 | |
9 |