Forum Discussion
imcdonald83
9 years agoRegular Visitor
Previous date values
Hi Guys Hoping you can maybe help. Im new to Power BI, and I have been working on some dashboard to help calculate the % shift of sales day on day. I have got it working to an extent by gett...
- 9 years ago
Hi imcdonald83,
Sorry for my mistake. Rather than a measure, we should create a calculated column using:
Pre = CALCULATE([Sales],CARDS_DATES_POWERBI[Date]=EARLIE
R(CARDS_DATES_POWERBI[predate])) Regards,
Yuliana Gu
v-yulgu-msft
9 years agoMicrosoft Employee
Hi imcdonald83,
In your scenario, please first create a calculated column:
predate =
CALCULATE (
MAX ([Date] ), FILTER ( CARDS_DATES_POWERBI, CARDS_DATES_POWERBI[Date] < EARLIER ( CARDS_DATES_POWERBI[Date] ) ) )Then, create a measure:
Pre = CALCULATE([Sales],CARDS_DATES_POWERBI[Date]=EARLIER(CARDS_DATES_POWERBI[predate]))
Best regards,
Yuliana Gu
- imcdonald839 years agoRegular Visitor
The creating of the predate column works fine, but the Earlier function is not recognising predate as part of a measure.
EARLIER/EARLIEST refers to an earlier row context which doesn't exist.
- v-yulgu-msft9 years agoMicrosoft Employee
Hi imcdonald83,
Sorry for my mistake. Rather than a measure, we should create a calculated column using:
Pre = CALCULATE([Sales],CARDS_DATES_POWERBI[Date]=EARLIE
R(CARDS_DATES_POWERBI[predate])) Regards,
Yuliana Gu