Skip to main content
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
Showing results for 
Search instead for 
Did you mean: 
Contributor II
Contributor II

Using a variable in a line chart dimension

Hey Community,

I've searched high and low for an answer without any luck so I figured i'd see if you guys could help me out. 

I'm creating a line chart which I want to use a couple different ways. The first way is sales by day of the month, this would just display days 1-31 on the x axis to show the MTD sales, for an example it would be used to show November 2019 and November 2020 and the user can see how the sales compare as the month goes on. 

The second way is to use actual the actual date field in my data which is Entered Date, using this they can select longer date ranges if they want to dig into the date. 

My plan was to use the qsVariable extension with a drop down list to change the dimension to either the Day of Month or the Entered Date. However, i have the IF equations below that i've tried and they just don't seem to work. It seems to have trouble giving me the else condition, i can't seem to get the x axis to change with this. It works great if i add these as alternative dimensions, however the goal is to make this easier for the users. Any thoughts as to what might solve this? Is it even possible to switch the x axis with a variable and if equation?

if(MTDChart = 'MTD',[Day of Month],[Entered Date])

if(MTDChart = 'EnteredDate', [Entered Date], if(MTDChart = 'MTD',([Day of Month])))

I've also tried test conditions such as If(Year(Today())= 2020, [Day of Month],[Entered Date]) and that works, i'm thinking it's something with the variables in the dimension but i'm new to this and not sure how else to troubleshoot.



Labels (3)
2 Replies

May be you are checking drilldown option More info 

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Contributor II
Contributor II

Thanks for the response,  i'm not using the drill down option and I don't believe that would work in the situation because I would need the Y axis to change the measurement calculation as well.