Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
mhapanka
Creator
Creator

Sorting in ascendng order when Variable with logic is a dimension

Hi ,

I have a kind of confusing question here!

If you look at the graph below, it uses Variables to to be filtered by which is a dimension as follows:

=if($(vselector2)=1,[Fiscal Year],

if($(vselector2)=2,[Fiscal Quarter],

if($(vselector2)=3,[FiscalMonth1])))capture 3.PNG

And I have sorted it using Expression: NUM(Replace([Fiscal Quarter],'-Q','')) to get the Quarters sorted right.

However, the months now are not sorted correctly and I'm unsure how to do this because month is not a separate dimension. Quarter, month and year are a part of the variable the graph will get filtered by as given in green above.

How do I get year months and quarters sorted in ascending order when the respective filter is chosen

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

Try

=if($(vselector2)=1,[Fiscal Year],

if($(vselector2)=2,Num#(Replace([Fiscal Quarter],'-Q','')),

if($(vselector2)=3,Num#(Replace([FiscalMonth1],'/','')) )))

BTW - Pick() might be easier to use instead of nesting ifs:

=Pick( vselector2 ,

[Fiscal Year],

Num#(Replace([Fiscal Quarter],'-Q','')),

Num#(Replace([FiscalMonth1],'/',''))

)

View solution in original post

5 Replies
petter
Partner - Champion III
Partner - Champion III

Have you tried using the same If()-logic with the sort expression?

mhapanka
Creator
Creator
Author

=if($(vselector2)=1,[Fiscal Year],

if($(vselector2)=2,NUM(Replace([Fiscal Quarter],'-Q','')),

if($(vselector2)=3,[FiscalMonth1])))

I tried this, didnt work for months

petter
Partner - Champion III
Partner - Champion III

Try

=if($(vselector2)=1,[Fiscal Year],

if($(vselector2)=2,Num#(Replace([Fiscal Quarter],'-Q','')),

if($(vselector2)=3,Num#(Replace([FiscalMonth1],'/','')) )))

BTW - Pick() might be easier to use instead of nesting ifs:

=Pick( vselector2 ,

[Fiscal Year],

Num#(Replace([Fiscal Quarter],'-Q','')),

Num#(Replace([FiscalMonth1],'/',''))

)

mhapanka
Creator
Creator
Author

This worked!

Thanks so much

petter
Partner - Champion III
Partner - Champion III

You're welcome