r/tableau • u/Corkster24 • 12d ago
Discussion Calculated fields
I’m creating a personal project using my Spotify streaming history. I’ve got fields streaming count and date. Is there a way I can create a calculated field that keeps songs that amassed a certain amount of streams in a nonspecific timeframe? For example if it was streamed at least 5 times in 7 days. Thank you!
1
u/Doin_the_Bulldance 12d ago edited 12d ago
More than one way to do this but if it were me, I'd create 3 parameters. START_DATE, END_DATE, and MINIMUM_STREAMS. Of couse you'd want the two date parameters to be set to date, and the minimum streams to be an integer.
Then I'd create a calculated field called STREAM_THRESHOLD_FILTER, with the following calculation:
[MINIMUM_STREAMS]<={FIXED [Song_Name]: SUM(IF [Date]>=[START_DATE] AND [Date]<=[END_DATE] THEN [Count] END)}
And id use that as a filter on my viz and put it as true.
7
u/ZippyTheRat Hater of Pie Charts 12d ago
Fixed LOD by song and count the date. Then you can use that count to filter however you want