Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I am refering to the article below to calculate a table to be used for time intelligence.
Phil Seamark on DAX
I have been able to recreate a few of the options I needed following the same pattern. The ones I am having trouble with are: Last Month, Last Week, This week. When Last month for example is select I would like for it to only show the months in last month. Currently the formula below will calculate all of last month and up to the current date.
Solved! Go to Solution.
@Jmccoy make this change in your DAX expression for last 2 and 3 months logic
instead of TODAY change it to
EOMONTH(Today,-1)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi @Jmccoy
Something like this?
//Last Month
ADDCOLUMNS (
GENERATE (
SELECTCOLUMNS ( { "Last Month" }, "Period", [Value] ),
GENERATESERIES (
EDATE ( DATE ( ThisYear, ThisMonth, 1 ), -1 ),
DATE ( ThisYear, ThisMonth, 1 ) - 1
)
),
"Axis Date", [Value]
)
and similar for the others
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
You should show what the exact expected result is. Try this
// Current week
ADDCOLUMNS (
GENERATE (
SELECTCOLUMNS ( { "Current week" }, "Period", [Value] ),
VAR weekStart_ = Today - (WEEKDAY(Today,2)-1)
RETURN GENERATESERIES ( weekStart_, weekStart_+6)
),
"Axis Date", [Value]
),
// Last week
ADDCOLUMNS (
GENERATE (
SELECTCOLUMNS ( { "Last week" }, "Period", [Value] ),
VAR weekStart_ = Today-7 - (WEEKDAY(Today-7,2)-1)
RETURN GENERATESERIES ( weekStart_, weekStart_+6)
),
"Axis Date", [Value]
)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Thank you so much, this is working exactly how I would like it to.
Hi @Jmccoy
Something like this?
//Last Month
ADDCOLUMNS (
GENERATE (
SELECTCOLUMNS ( { "Last Month" }, "Period", [Value] ),
GENERATESERIES (
EDATE ( DATE ( ThisYear, ThisMonth, 1 ), -1 ),
DATE ( ThisYear, ThisMonth, 1 ) - 1
)
),
"Axis Date", [Value]
)
and similar for the others
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
I am still having issues getting this week and last week. Please help!!
@Jmccoy make this change in your DAX expression for last 2 and 3 months logic
instead of TODAY change it to
EOMONTH(Today,-1)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Thank you very much!
Please see if this video helps. It's a different approach but may create the columns for relative day, week, month, etc. you need for your calculations.
Power BI Tales From The Front - Day/Week/Month/Quarter/Year Indices - YouTube
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
104 | |
69 | |
48 | |
41 | |
34 |
User | Count |
---|---|
164 | |
112 | |
62 | |
54 | |
38 |