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.
Hi all,
I am very new to PowerBI but i am building a report where one of the columns has to show the date in the format 'yyyy-mm-dd' for the prior month of when it's running, so if in march 2021 should show the first day of February 2021 in the format referred previously.
Appreciate assistance.
Best Regards,
Daniel
Solved! Go to Solution.
Hi, @danielcarreira1
Based in your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may create a calculated column or a measure as below.
Calculated column:
Result Column = EOMONTH([Date],-2)+1
Measure:
Result Measure = EOMONTH(SELECTEDVALUE('Table'[Date]),-2)+1
Result(You can modify the format in 'Column tools'):
Or you may go to 'Query Editor'm create a custom column with the following m codes.
Date.AddDays( Date.EndOfMonth( Date.AddMonths([Date],-2) ),1)
Then you can modify the format as you want in Power BI Desktop. Here is the result.
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @danielcarreira1
Based in your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may create a calculated column or a measure as below.
Calculated column:
Result Column = EOMONTH([Date],-2)+1
Measure:
Result Measure = EOMONTH(SELECTEDVALUE('Table'[Date]),-2)+1
Result(You can modify the format in 'Column tools'):
Or you may go to 'Query Editor'm create a custom column with the following m codes.
Date.AddDays( Date.EndOfMonth( Date.AddMonths([Date],-2) ),1)
Then you can modify the format as you want in Power BI Desktop. Here is the result.
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@danielcarreira1 , You can try measure like
eomonth(max(Date[Date]),-2)+1
or
eomonth(today(),-2)+1
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |