First Mon, Tue, Wed, Thu, Fri, Sat and Sun of the …

Use Case – I published First Mon, Tue, Wed, Thu, Fri, Sat and Sun of the Month in Power Query Language M which gave formulas for language M. Same formulas are given here for DAX language. There are many business scenarios where you would be asked to find first Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday of the Month.
For example, First Thursday of the month, the newsletter for last month’s events will be published.  Hence, if a date is given, following should be the answer



Solution –  Following DAX formulas can be used to calculate these dates


First Monday of the Month
= CEILING(EOMONTH([Date],-1)-1,7)+2

First Tuesday of the Month
= CEILING(EOMONTH([Date],-1)-2,7)+3

First Wednesday of the Month
= CEILING(EOMONTH([Date],-1)-3,7)+4

First Thursday of the Month
= CEILING(EOMONTH([Date],-1)-4,7)+5

First Friday of the Month
= CEILING(EOMONTH([Date],-1)-5,7)+6

First Saturday of the Month
= CEILING(EOMONTH([Date],-1)-6,7)+7

First Sunday of the Month
= CEILING(EOMONTH([Date],-1)-7,7)+8


You can download sample pbix file from!Akd5y6ruJhvhuX_-lFzt8pUhgpTS?e=8cL4pj 

Source link

Be the first to comment

Leave a Reply

Your email address will not be published.