Forum Discussion
PreviousDay for First Date in Dataset
- 3 years ago
Hi, S3 ;
Try it.
Previous Period Value = var _a= CALCULATE([Value Measure] ,DATESBETWEEN( Dates[Date], [Start of Previous Period], [End of Previous Period]), ALL(Dates)) var _diff2=DATEDIFF( CALCULATE(MIN('Dates'[Date]),ALLSELECTED(Dates)),CALCULATE(MAX('Dates'[Date]),ALLSELECTED(Dates)),DAY) var _diff1=DATEDIFF( CALCULATE(MIN('Dates'[Date]),ALL(Dates)),CALCULATE(MIN('Dates'[Date]),ALLSELECTED(Dates)),DAY) return IF(CALCULATE(SUM('Table'[value]),ALL('Table'))=_a||_diff1<_diff2,BLANK(), _a)The final show:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello lbendlin ,
thanks for your reply. I actually changed my previous Dataset from monthly to daily, so now I have all dates in my Calender.
Please provide sanitized sample data that fully covers your issue.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Please show the expected outcome based on the sample data you provided.
- S33 years agoHelper III
here's a link to the sample data:
https://drive.google.com/file/d/1NKjo6Jp3-ZexOr8-pbstcmQuwjDNfu8l/view?usp=sharing
When one filters the dates between 01.01.2022 and 31.01.2022, it still shows a difference between this period and previous period, even though there's no previous period, and I would like it to show N/A or 0
The Previous Period Value is used only to calculate the Difference, if there's a way to show the real value of the previous period, that would also be very good.
Thanks so much for replying.