cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Joe_100 Helper I
Helper I

Simple return of month name

Hi,

 

Simple question but i can't seem to get it right.
I have a table with the 12 the month names and their corresponding numbers.

MonthNameMonthnumber
Jan1
Feb2
Mar3

 

etc.

I have a slicer on monthname.
If one of the monthnames is selected i also need to return the previousmonth name in a textfield.

Started with this simple DAX but i am not sure how to return the previous month name?

Returning the previous month number works of course.

PVmonth =
VAR pvmonth1 = SELECTEDVALUE(MonthTitlesUsedInReport[MonthNumber])
VAR pvmonth = pvmonth1 -1
RETURN

???????

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Joe_100 Helper I
Helper I

Re: Simple return of month name

Solved it with a lookup value, but i guess there should be an easier way?

 

PVmonth =
VAR pvmonth1 = SELECTEDVALUE(MonthTitlesUsedInReport[MonthNumber])
VAR pvmonth = pvmonth1 -1
RETURN
LOOKUPVALUE(MonthTitlesUsedInReport[MonthName];MonthTitlesUsedInReport[MonthNumber];pvmonth)

View solution in original post

2 REPLIES 2
Joe_100 Helper I
Helper I

Re: Simple return of month name

Solved it with a lookup value, but i guess there should be an easier way?

 

PVmonth =
VAR pvmonth1 = SELECTEDVALUE(MonthTitlesUsedInReport[MonthNumber])
VAR pvmonth = pvmonth1 -1
RETURN
LOOKUPVALUE(MonthTitlesUsedInReport[MonthName];MonthTitlesUsedInReport[MonthNumber];pvmonth)

View solution in original post

Community Support
Community Support

Re: Simple return of month name

Hi @Joe_100

There is a simple way

Measure = CALCULATE(MAX(Table1[MonthName]),FILTER(ALL(Table1),[Monthnumber]=MAX(Table1[Monthnumber])-1))

5.png

 

Best Regards

Maggie

Helpful resources

Announcements
Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ Integration Forum Launch

‘Better Together’ Integration Forum Launch

We've launched a how-to forum where you can learn about how Power BI integrates with other Power Platform products.

Top Solution Authors
Top Kudoed Authors