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
SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,344 questions
2 answers
Sort by: Most helpful
-
-
Lukas Yu -MSFT 5,826 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]"))