Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Vern2022
Contributor III
Contributor III

Label of the column to change with condition

Hi,

I have a field called Month and a field called Year being pulled from a dates table. The measure is using the Month Offset field in the same table, pulling the measure of something else in accordance with the Month Offset in the measure.

As time goes one, the month offset will change, for example, minus one month takes us to Feb, but next month that will take us to March. As the table is going to be accumulative,  I need the field names to change accordingly. I want the field/label name to change as time goes on so the field name reflects the offset condition. My measure (using set analysis )works fine.

But this isn't working with the label.

=if([Month Offset] = 0, Concat([Month] & '-' & [Year]), 'no')

I have put 'no' as the else statement as a test, unfortunately, no is being printed as the label.

Why is this not concetating and putting the Month and Year names together where the row is 0 in the Month Offset field? Can someone fix my formula. Many thanks.

Labels (4)
4 Replies
G3S
Creator III
Creator III

if the Month offset field has multiple values 'no' would be printed. 

if are requiring the label to work calculate based on today's date, then you can try labeling using today() function.

Vern2022
Contributor III
Contributor III
Author

Hi,

I am sorry if I am being daft. Can you please give me an example in how I would do this with code?

Many thanks.

Channa
Specialist III
Specialist III

in label 

monthname(today()-1)

Channa
AustinSpivey
Partner - Creator
Partner - Creator

Channa has it right but I think the expression is missing a comma:

=MonthName(Today(), -1)

If the [Month Offset] is dynamic, you could just do:

=MonthName(Today(), [Month Offset] * -1)

Austin Spivey | Principal Consultant @ Arc Analytics
ArcAnalytics.us | Add me on LinkedIn