cancel
Showing results for
Did you mean:
Frequent Visitor

## Financial Sale Week Number on Card

I am looking for DAX Help

I have a Calendar Table which has Weeknumber and Financial Sale Week Number

On Main DashBoard - I need to Show Three Cards Visuals - which Shows OR One Multi Card

1) First Sale Week of the Month
2) Current Sale Week
3) Last Sale week of the Month

3 REPLIES 3
Super User

hi @heygau ,

It will depend on whether your current month is based on today's date or the max date as selected in the slicer. For example, what is the max date in FY23.

Proud to be a Super User!

"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Frequent Visitor

@danextian  Dash Board has an option to choose Year and Month only, Once we choose Month cards shouls show First Week of the month and  Max week of the month and current week of the month

Super User

@heygau , if you need based on today

WTD Today =
var _min = TODAY() -WEEKDAY(TODAY(),2) +1 //Monday week start
var _max = today()
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

LWTD Today =
var _min = TODAY() -WEEKDAY(TODAY(),2) -6 //Monday week start
var _max = today() -7
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

LYWTD Today =
var _max = today() -364
var _min = _max -WEEKDAY(_max,2) +1//Monday week start
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

WTD Yesterday =
var _max = today() -1
var _min = _max -WEEKDAY(_max,2) +1 //Monday week start
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

LWTD Yesterday =
var _max = today() -8
var _min = _max -WEEKDAY(_max,2) +1 //Monday week start
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

LYWTD Yesterday =
var _max = today() -364
var _min = _max -WEEKDAY(_max,2) +1//Monday week start
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

This Week Today =
var _min = today() -WEEKDAY(today() ,2) +1 //Monday week start
var _max = _min +6
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

Last Week Today =
var _min = today() -WEEKDAY(today() ,2) -6 //Monday week start
var _max = _min +6
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

Last year same week Today =
var _today = today() -364
var _min = _today -WEEKDAY(_today,2) +1//Monday week start
var _max = _min+6
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

First week month Week Today =
var _date = eomonth(today(),-1)+1
var _min = _date-WEEKDAY(_date ,2) +1 //Monday week start
var _max = _min +6
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

If you need based on selected value

Have these new columns in Date Table, Week Rank is Important in Date/Week Table

Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format
WeekDay = weekday([Date],2)

These measures can help
This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))

First week month Week Today =
var _date = eomonth(max('Date'[Week Rank]),-1)+1
var _min = _date-WEEKDAY(_date ,2) +1 //Monday week start
var _max = _min +6
return CALCULATE([Net], FILTER(all('Date'),'Date'[Date] >=_min && 'Date'[Date] <= _max))

Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

Announcements

#### Power BI T-Shirt Design Challenge 2023

Vote for your favorite t-shirt design now through March 28.

#### Power BI March 2023 Update

Find out more about the March 2023 update.

#### March 2023 Events

Find out more about the online and in person events happening in March!

Top Solution Authors
Top Kudoed Authors