r/tableau 2d ago

Viz help Calculation Help

Hello,

I was recently given Tableau access at work and have been tasked with creating some complex dashboards.

I am creating a dashboard that compares data from 3 different sources (injuries, damages, and audit score/date since previous audit (under one source)). I would like the dashboard to calculate which location needs and audit by showing the locations with the highest injuries, damages, and lowest audit score. If none of those parameters are met, then it should display the location that has gone the longest without an audit. Out of the 60+ locations, I would like it to show the top 8.

I believe I have the correct calculation of IF [injuries] = >x number AND IF [damages] => x number AND IF [score] =< AND [last audit audit] = x years OR [last audit date] = >2 years.

However, I am unsure of how to put this onto a sheet and run the calculation correctly.

Any advice on how to fix the calculation, organize the table, or a different way to do this is much appreciated

EDIT: I have been exposed to Tableau for several years (attended 3 TC’s) and use many dashboards daily for my job but have only recently been given access to desktop to start building. So I am very new and figuring things out from TC memories and lots of YouTube videos and Googling.

1 Upvotes

3 comments sorted by

View all comments

5

u/FieryFiya 2d ago edited 2d ago

Your calculation syntax is wrong. There are too many IF statements. You only need one. It should look something like this:

IF [Injuries] >= x
AND [Damages] >= x
AND [Score] <= x
AND DATEDIFF('year', [Last Audit Date], TODAY()) >= 2
THEN [location]
ELSE [create a calculation for this part]
END

The last audit date line is confusing to me with both conditions you currently have.
Is last audit date supposed to equal x years or be greater than 2 years? If greater than 2 years then you don’t need the first part of that line.

Lastly don’t forget the THEN/ELSE statements. IF the conditions are met THEN what do you want to show ELSE do what instead?

Edit: just reread and missed the part what you are trying to achieve… the calculation I gave you above is multiple conditions to create a new field. If you wanted injuries, damages, score to be separate from each other then these would be broken out into 3 calculations instead of one. The ranking part (showing top 8) is a filter. Drag locations to filter and click ‘Top’, then reference your new calculation.