Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
I have visual where I want the table to say 'Current Month vs Last Month' with the month names changing dynamically based on slicer value.
What I have currently is this:
Solved! Go to Solution.
@atowriss99 Assuming you meant Feb 2023 vs. Jan 2023 and making various other assumptions about your data model then perhaps something like this:
Current v Prior Month =
VAR __CurDate = MAX('Date'[Date])
VAR __CurMonth = SELECTEDVALUE('Date'[Month Name Short])
VAR __CurYear = SELECTEDVALUE('Date'[Year])
VAR __PrevDate = EOMONTH(__CurDate, -1)
VAR __PrevMonth = FORMAT(__PrevDate, "mmm")
VAR __PrevYear = YEAR(__PrevDate)
VAR __Result = __CurMonth & " " & __CurYear & " versus " & __PrevMonth & " " & __PrevYear
RETURN
__Result
@atowriss99 Assuming you meant Feb 2023 vs. Jan 2023 and making various other assumptions about your data model then perhaps something like this:
Current v Prior Month =
VAR __CurDate = MAX('Date'[Date])
VAR __CurMonth = SELECTEDVALUE('Date'[Month Name Short])
VAR __CurYear = SELECTEDVALUE('Date'[Year])
VAR __PrevDate = EOMONTH(__CurDate, -1)
VAR __PrevMonth = FORMAT(__PrevDate, "mmm")
VAR __PrevYear = YEAR(__PrevDate)
VAR __Result = __CurMonth & " " & __CurYear & " versus " & __PrevMonth & " " & __PrevYear
RETURN
__Result
Exactly what I wanted!
Thanks!