6 Replies Latest reply on Feb 1, 2019 3:16 AM by Roger Pouly

# Going from regular format to percent difference with a parameter (changing the format in the calculated field) - Is this possible ?

Good morning everyone, apoligize for the title.

An interesting task I would like to do is to be able to switch the view from regular numbers to percent difference, from a parameter. My issue here is formating.

Exemple here, when the parameter is set to value :

When the parameter is set to % difference :

What I would like to see is :

Here is my formula :

IF [Choosing view Parameter]="% diff" THEN (ZN([Number of sales]) - LOOKUP(ZN([Number of sales]), -1)) / ABS(LOOKUP(ZN([Number of sales]), -1)) ELSEIF [Choosing view Parameter]="Regular" THEN [Number of sales]

Any hindsight ?

Thank you

Roger

• ###### 1. Re: Going from regular format to percent difference with a parameter (changing the format in the calculated field) - Is this possible ?

Hi Roger,

The formatting issue can be resolved by returning a fraction and multiplying by 100 as well as adding "%" as part of your calculation. However even if you add more decimal places to the percentage value, does this return the expected ones, could you make sure that you are computing across?

Cheers,

Sasha

• ###### 2. Re: Going from regular format to percent difference with a parameter (changing the format in the calculated field) - Is this possible ?

Hi Sasha, thank you for this quick answer.

Would you mind explaining what do you mean by "returning a fraction and multiplying by 100 as well as adding "%" as part of your calculation" ? I don't quite get what to do.

This is computed accross indeed, and returns the expected results.

Thank you,

Roger

• ###### 3. Re: Going from regular format to percent difference with a parameter (changing the format in the calculated field) - Is this possible ?

Hi Roger,

Apologies for not being clear, it is not possible to set different formats in a single measure (although it has several outputs dependant on your parameter). My thoughts were to return the percentage value, so for destination 1 = 42.18 and add the percentage symbol to it with a calculation like this:

str([%number of sales])+"%"

Hope this helps!

Cheers,

Sasha

1 of 1 people found this helpful
• ###### 4. Re: Going from regular format to percent difference with a parameter (changing the format in the calculated field) - Is this possible ?

Hi Sasha,

Thank you for your answer. I need to use measures so it is a bit sad, I guess I'll need to find another way to convey this information.

Have a nice day,

Roger

• ###### 5. Re: Going from regular format to percent difference with a parameter (changing the format in the calculated field) - Is this possible ?

No problem, here is another very similar but possible workaround:

Cheers,

Sasha

• ###### 6. Re: Going from regular format to percent difference with a parameter (changing the format in the calculated field) - Is this possible ?

Good find ! It is weird, because my first approach was to try something like this, but my measure still showed even when Null, meaning both measures would show anyway  :

In the Information Lab article though, only the selected measure show on the workbook. Maybe because it is from 4 years ago ?

Thanks,

Roger