Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
How to create measure of black Friday sale only each year(column format : Friday, November 27,2020)
Solved! Go to Solution.
Hi @lucifer ,
I modify the samle data to multiple sales on same day.
And modify the formula:
Measure =
VAR _T1 =
CALENDARAUTO ()
VAR _T2 =
FILTER ( _T1, MONTH ( [Date] ) = 11 && WEEKDAY ( [Date], 2 ) = 4 )
VAR _T3 =
FILTER (
ADDCOLUMNS (
_T2,
"Rank",
RANKX (
FILTER ( _T2, YEAR ( [Date] ) = YEAR ( EARLIER ( [Date] ) ) ),
[Date],
,
ASC
)
),
[Rank] = 4
)
VAR _Col =
SELECTCOLUMNS ( _T3, "Blank Friday", [Date] )
RETURN
SUMX ( FILTER ( 'Table', 'Table'[Date] - 1 IN _Col ), 'Table'[Sales] )
Get the correct result.
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @lucifer ,
According to your description, I create a sample.
As you can see, Friday, November 27,2020 and Friday, November 26,2021 are blank fridays. Here's my solution.
Create a measure.
Measure =
VAR _T1 =
CALENDARAUTO ()
VAR _T2 =
FILTER ( _T1, MONTH ( [Date] ) = 11 && WEEKDAY ( [Date], 2 ) = 4 )
VAR _T3 =
FILTER (
ADDCOLUMNS (
_T2,
"Rank",
RANKX (
FILTER ( _T2, YEAR ( [Date] ) = YEAR ( EARLIER ( [Date] ) ) ),
[Date],
,
ASC
)
),
[Rank] = 4
)
VAR _Col =
SELECTCOLUMNS ( _T3, "Blank Friday", [Date] )
RETURN
MAXX ( FILTER ( 'Table', 'Table'[Date] - 1 IN _Col ), 'Table'[Sales] )
Get the result.
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@v-yanjiang-msft not working
i think this solution will not work for multiple sales on same day, your data has one sale on each day
Hi @lucifer ,
I modify the samle data to multiple sales on same day.
And modify the formula:
Measure =
VAR _T1 =
CALENDARAUTO ()
VAR _T2 =
FILTER ( _T1, MONTH ( [Date] ) = 11 && WEEKDAY ( [Date], 2 ) = 4 )
VAR _T3 =
FILTER (
ADDCOLUMNS (
_T2,
"Rank",
RANKX (
FILTER ( _T2, YEAR ( [Date] ) = YEAR ( EARLIER ( [Date] ) ) ),
[Date],
,
ASC
)
),
[Rank] = 4
)
VAR _Col =
SELECTCOLUMNS ( _T3, "Blank Friday", [Date] )
RETURN
SUMX ( FILTER ( 'Table', 'Table'[Date] - 1 IN _Col ), 'Table'[Sales] )
Get the correct result.
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@lucifer I have a US Holidays table calculation that can flag black friday. United States Holidays - Microsoft Power BI Community
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 |
|---|---|
| 6 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |