11 Replies Latest reply on Oct 24, 2019 9:24 AM by Nick Parsons

# Simple If statement with one catch.

Hello,

I have an if case, very simple but with one complexity.

IF [Nombre del día] = 'Monday'

THEN [Real actual Param]

ELSE 0

END

Is basically this, but with one catch. I need that in case [Nombre del día] is another day than Monday it should repeat the value for monday.

As how is written now i have:

Monday 54

Tuesday 0

Wednesday 0

Thusday 0

Friday 0

Satudray 0

Sunday 0

And i need a formula that help me, repeating the values in monday, like:

Monday 54

Tuesday 54

Wednesday 54

Thusday 54

Friday 54

Satudray 54

Sunday 54

Hope i make it clear.

Mensaje editado por: Juan Jose Lavandero

• ###### 1. Re: Simple If statement with one catch.

{MAX

(IF [Nombre del día] = 'Monday'

THEN [Real actual Param]

ELSE 0

END)}

• ###### 2. Re: Simple If statement with one catch.

I'm thinking you're going to need an LOD to contain it within your weeks. Something like this (sub sales with your calc).

{fixed DATETRUNC("week", [Order Date]) : Max([Sales])}

• ###### 3. Re: Simple If statement with one catch.

For some reason it didn't workout well. i attached the file so you can see it; maybe thats better. In the file you can see the data for each week; the idea is to have the monday (or first day of the week if there is no info) sum for each day of the week, in the attached file i already get it to have the number of monday, but cant make tableau to repeat it each day of the same week.

• ###### 4. Re: Simple If statement with one catch.

For some reason it didn't workout well. i attached the file so you can see it; maybe thats better. In the file you can see the data for each week; the idea is to have the monday (or first day of the week if there is no info) sum for each day of the week, in the attached file i already get it to have the number of monday, but cant make tableau to repeat it each day of the same week.

• ###### 5. Re: Simple If statement with one catch.

Thanks for share, but you need to post a packaged workbook. Goto file/save as and select twbx as the file type, or file/export packaged workbook.

• ###### 6. Re: Simple If statement with one catch.

I tried to...but it gets too heavy, let me try another way.

https://we.tl/t-Ghjlbm6qdt

There is the twbx file on wetransfer.

• ###### 7. Re: Simple If statement with one catch.

Is this what you are looking for?

If so, use this calc:

LOOKUP(sum([Real actual Param]), first())

Then re-add it to your viz, right click it, change compute using to Pane Down.

• ###### 8. Re: Simple If statement with one catch.

Nick, sorry for the late reply.

Thank you very much!!

I have an issue now, and maybe you can help me to solve it. I want to take this calculated field to a line chart but when i put the field on the chart i doesn´t allow me to compute using Pane Down.

im attaching the TWBX and the field that i create using your formula is the one named "REAL Ppto Param".....hope you can help me with this.

Regards and thank you very much.

https://we.tl/t-Z2IxwzMigp

1 of 1 people found this helpful
• ###### 9. Re: Simple If statement with one catch.

1. Add Semana to Columns, between Mes and Dia. This will define the Pane, since the Table calc is based on Pane.

2. Right click one of the week numbers and uncheck "show header". This will remove the week numbers.

3. Got formatting, format borders, columns, set column divider to the left one step. This will remove the "week" lines.

4. That's it! You may want to remove outliers (if they aren't relevant) that are causing your axis to be too large of a range.

Hope this works and is helpful.

Nick

1 of 1 people found this helpful
• ###### 10. Re: Simple If statement with one catch.

For some reason, as soon as i put the Measure, i can not compute using pane down.

And, other thing.....maybe it can't be done but i was thinking thet chart to be more like the one i send at the begining...one line getting higher thru the entire month but continuosly....and the new calculation to be like a stair, lineal bu changing each week up or down.

Hope you can help me!!

• ###### 11. Re: Simple If statement with one catch.

You'll want Pane Across, since your pane is horizontal now.

For your second question, it may require a different calc, not sure yet. I can take a look later this week but you may want to post a new question to get a faster response.

Nick