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.
I have data as shown below:
Expected o/p is nearest non-blank value in the same period last year. If for Sameperiod last year Value is not available, returns a blank, it should search both before and after that month (expanding outward month-by-month) for until a closest non-blank is found
Date | Value | Expected o/p |
29/12/2023 | 800 | |
15/02/2024 | 50 | |
28/04/2024 | 40 | |
08/04/2024 | 80 | |
07/01/2025 | 90 | 800 |
08/01/2025 | 50 | 800 |
13/01/2025 | 900 | 800 |
10/02/2025 | 60 | 50 |
28/02/2025 | 80 | 50 |
17/03/2025 | 150 | 50 |
15/04/2025 | 100 | 80 |
Solved! Go to Solution.
SAMEPERIODLASTYEAR for a single value is ambiguous. Please be more specific. Do you mean "prior year" ?
or like this
Spot On! Just that total is incorrect.
Which one is spot on? For the total to be correct you can wrap the code in an aggregation.
First one, but is it not already wrapped in aggregation.?
User | Count |
---|---|
24 | |
10 | |
8 | |
7 | |
6 |
User | Count |
---|---|
32 | |
12 | |
10 | |
10 | |
9 |