Forum Discussion
dyanmic date parameters
inonb In PowerQuery use params from start and end date. Then evaluate the end date using Date.DayOfWeek, do the math and then use the adjusted end date to do the filtering of the data.
- inonb6 years agoFrequent Visitor
thanks of reply
Can you send me link of example
- JirkaZ6 years agoSolution Specialist
inonb First of all you have to create the start and end date parameters in query editor (of DATE type).
Then the query itself would look something like:
let
EndDateDW = Date.DayOfWeek(EndDate),
EndDateAdjusted = if (EndDateDW = 4 or EndDateDW = 5) then Date.AddDays(EndDate, EndDateDW - 1) else Date.AddDays(EndDate, 2),
//Now you can use the StartDate and EndDate params in your query
Source = ""
in
Source - v-xuding-msft6 years agoCommunity Support
Hi inonb ,
I add a blog that you can reference. The entire blog does not meet your requirement exactly. However, you can reference the Parameter part to understand how to create and use it.
https://radacad.com/create-a-date-dimension-in-power-bi-in-4-steps-step-1-calendar-columns
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- inonb6 years agoFrequent Visitor
thanks
i have a project in visual studio-tabular model , do i need to write dax instead power query?