Forum Discussion
Ju7438
4 years agoRegular Visitor
Expand date range with repeated pattern
Hello there, I need to do something hard in power BI and im struggling... Let me explain, i have a row with date range (start and end) that i need to expand in row for each day between, easy unti...
- 4 years ago
Hi,
Thank you very much for your feedback, and sorry that I did not check carefully.
Please check the attached pbix file if it suits the requirement.
New Table 2 = VAR _mindate = MIN ( Data2[Start_Date] ) VAR _maxdate = MAX ( Data2[Repeat_Until] ) VAR _calendartable = ADDCOLUMNS ( CALENDAR ( _mindate, _maxdate ), "@dayname", FORMAT ( [Date], "ddd" ) ) VAR _generatetable = GENERATE ( FILTER ( Data2, Data2[Repeat_Until] <> BLANK () ), FILTER ( _calendartable, [@dayname] IN { FORMAT ( Data2[Start_Date], "ddd" ), FORMAT ( Data2[End_Date], "ddd" ) } && [Date] <= Data2[Repeat_Until] && [Date] >= Data2[Start_Date] ) ) VAR _generatetabletwo = GENERATE ( FILTER ( Data2, Data2[Repeat_Until] = BLANK () ), FILTER ( _calendartable, [Date] >= Data2[Start_Date] && [Date] <= Data2[End_Date] ) ) RETURN UNION ( SUMMARIZE ( _generatetable, Data2[ID], Data2[Start_Date], Data2[End_Date], Data2[Repeat_Until], [Date] ), SUMMARIZE ( _generatetabletwo, Data2[ID], Data2[Start_Date], Data2[End_Date], Data2[Repeat_Until], [Date] ) )
amitchandak
Super User
4 years agoJu7438 , Check this blog on power query can help
https://amitchandak.medium.com/power-query-get-all-dates-between-the-start-and-end-date-9ad6a84cf5f2
or the attached file with dax code
Ju7438
4 years agoRegular Visitor
Hi mate and thanks for your interest, unfortunatelly this way doesn't work in my case 😞 ..
BR
Julien