The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi All,
I would need some direction on Additional logic on retrieving previous value. Requirement is to exclude Weekends and holidays bring Friday Value over to Monday as Prev Value .
I already have weekend and holidays column as weekend_ind and holidays_ind.
Solved! Go to Solution.
Hi @ghost10,
Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly
To calculate the previous date values, you can try to use the following measure formulas:
formula =
VAR currDate =
MAX ( Table[Date] )
VAR holidayList =
VALUES ( Holiday[Date] )
VAR prevDate =
CALCULATE (
MAX ( Table[Date] ),
FILTER (
ALLSELECTED ( Table ),
[Date] < currDate
&& WEEKDAY ( [Date], 2 ) <= 5
&& NOT ( [Date] IN holidayList )
),
VALUES ( Table[Category] )
)
RETURN
CALCULATE (
SUM ( Table[Value] ),
FILTER ( ALLSELECTED ( Table ), [Date] = prevDate ),
VALUES ( Table[Category] )
)
Regards,
Xiaoxin Sheng
Hi @ghost10,
Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly
To calculate the previous date values, you can try to use the following measure formulas:
formula =
VAR currDate =
MAX ( Table[Date] )
VAR holidayList =
VALUES ( Holiday[Date] )
VAR prevDate =
CALCULATE (
MAX ( Table[Date] ),
FILTER (
ALLSELECTED ( Table ),
[Date] < currDate
&& WEEKDAY ( [Date], 2 ) <= 5
&& NOT ( [Date] IN holidayList )
),
VALUES ( Table[Category] )
)
RETURN
CALCULATE (
SUM ( Table[Value] ),
FILTER ( ALLSELECTED ( Table ), [Date] = prevDate ),
VALUES ( Table[Category] )
)
Regards,
Xiaoxin Sheng
User | Count |
---|---|
6 | |
4 | |
3 | |
3 | |
2 |
User | Count |
---|---|
9 | |
7 | |
6 | |
5 | |
4 |