StrToMember("[Time].[By Month].[Date].&[" & Format(Now(),"yyyy") & "-01-01T00:00:00]") : StrToMember("[Time].[By Month].[Date].&[" & Format(Now(),"yyyy-mm") &"-01T00:00:00]")
MDX code to get today's date
L G
1
Reputation point
Hello,
I created a query for Excel in Power Pivot using the visual designer. I currently have to change the dates every month.
I need to modify it so it automatically returns the data for January from the current year until the current month.
[Time].[By Month].[Date].&[2020-01-01T00:00:00] : [Time].[By Month].[Date].&[2020-08-01T00:00:00]
Thanks in advance
LG
2 answers
Sort by: Most helpful
-
-
Lukas Yu -MSFT 5,821 Reputation points
2020-08-24T05:43:05.687+00:00 You could also try YTD function as :
YTD(StrToMember("[Time].[By Month].[Date].&[" & Format(Now(),"yyyy-mm") &"-01T00:00:00]"))