Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now
Hello everyone,
I have the following problem, I want to compare the same time period for last year, if I have from 03/01/2018 to 03/21/2018, I need to compare in that period but for the 2017 but additionally that I compare the same stores, this I have achieved separately , the measure sale LY is the one that has the full period of the month with the same stores this is seen when filtering door type and the part of dates I have it in the measure sale LYD that calculates the same period of time, my problem is that I need that calculate the same period of time and same stores in one and at the end of the month is the same as sale LY.
File attachment
https://www.dropbox.com/s/qkn6kedmdx3ph7l/Test.pbix?dl=0
Solved! Go to Solution.
Solution:
Sales Value LYD =
VAR LastDaySelection =
LASTNONBLANK (
'Calendar'[Date],
[Sales Value]
)
VAR CurrentRange =
DATESBETWEEN (
'Calendar'[Date],
MIN ( 'Calendar'[Date] ),
LastDaySelection
)
VAR CurrentStores =
VALUES ( Sales[Store] )
VAR PreviousRange =
SAMEPERIODLASTYEAR ( CurrentRange )
VAR _Last =
CALCULATE (
[Sales Value],
PreviousRange,
CurrentStores
)
RETURN
IF (
[Sales Value LY] = BLANK (),
BLANK (),
_Last
)
hello if I tried it but it brings me the whole month and also brings me all the stores without distinction.
Solution:
Sales Value LYD =
VAR LastDaySelection =
LASTNONBLANK (
'Calendar'[Date],
[Sales Value]
)
VAR CurrentRange =
DATESBETWEEN (
'Calendar'[Date],
MIN ( 'Calendar'[Date] ),
LastDaySelection
)
VAR CurrentStores =
VALUES ( Sales[Store] )
VAR PreviousRange =
SAMEPERIODLASTYEAR ( CurrentRange )
VAR _Last =
CALCULATE (
[Sales Value],
PreviousRange,
CurrentStores
)
RETURN
IF (
[Sales Value LY] = BLANK (),
BLANK (),
_Last
)
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 40 | |
| 38 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 70 | |
| 69 | |
| 34 | |
| 33 | |
| 30 |