Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Partiular day's date table

How do I create a table listing dates for all Mondays/Tuesdays from a given start date till today?

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

Or dax table version 

datesMonAndTue = 
VAR _dates = CALENDAR( DATE( 2019, 1, 1 ), TODAY() )
VAR _result = FILTER( _dates, WEEKDAY( [Date] ) IN {2, 3} )
RETURN _result
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski



View solution in original post

4 REPLIES 4
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

Or dax table version 

datesMonAndTue = 
VAR _dates = CALENDAR( DATE( 2019, 1, 1 ), TODAY() )
VAR _result = FILTER( _dates, WEEKDAY( [Date] ) IN {2, 3} )
RETURN _result
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski



Anonymous
Not applicable

Thanks @Mariusz 
This solution worked for me...

Mariusz
Community Champion
Community Champion

Hi @Anonymous 

You can do it in query editor by adding this two queries like below.

start date  

#date(2019, 1, 1) meta [IsParameterQuery=true, Type="Date", IsParameterQueryRequired=true]

dates

let
    dates = List.Dates(  #"start date", Duration.Days( DateTime.Date( DateTime.LocalNow() ) - #"start date" ), #duration( 1, 0, 0, 0 ) ),
    #"Converted to Table" = Table.FromList(dates, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Dates"}}),
    #"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Dates", type date}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Date.DayOfWeekName( [Dates] ), type text ),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom", each [Custom] = "Monday" or [Custom] = "Tuesday")
in
    #"Filtered Rows"

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

evandrocunico
Resolver III
Resolver III

Hi @Anonymous 

 

create a table 

   calendar = CALENDAR("2018-01-01";"2021-12-31")

create a new column to calendar
  dayofweek = if(WEEKDAY('calendar'[Date];2)=1||WEEKDAY('calendar'[Date];2)=2;1;0)
 
create a measure
total days = sum(dayofweek)
 
 
regards

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.