8 Replies Latest reply on Apr 13, 2018 1:56 PM by Brad Kunst

# Need help getting min and max for combined data

I have data for individual depts. that I am combining for each date in a series.  I need to calculate the sum, avg, min, and max for each date group.  I have figured out how to get the sum and average using LOD calculations, however, I have not been able to calculate the min and max.

Following is a sample of my data:

Dept. (Dimension)     Date (Dimension)       Volume (Measure)

Dept1                                        3/3/2018                              33
Dept2                                        3/3/2018                            202
Dept3                                        3/3/2018                              42
3/3/2018  Total        277

Dept1                                      3/17/2018                              21
Dept2                                      3/17/2018                            139
Dept3                                      3/17/2018                              50
3/17/2018  Total      220

Dept1                                      3/31/2018                              23
Dept2                                      3/31/2018                            171
Dept3                                      3/31/2018                              48
3/31/2018  Total      242

Combined stats for 3 dates:

sum       739 (277+220+242)
avg        246 (sum / 3)
min        220
max        277

I have used the following LOD calculations in Tableau to get the sum and average and they are working.  I now need to figure out how to get the min and max.

Sum           sum({fixed [Dept], [Date]: min([Volume])})
Average    sum({fixed [Dept], [Date] : min([Volume])}) / countd([Date])

This forum has been great and very responsive in the past.  I am hoping to get another great response this time.

Thanks!

• ###### 1. Re: Need help getting min and max for combined data

Can you post your above data in excel format?

• ###### 3. Re: Need help getting min and max for combined data

Why I am not able to see attachment?

• ###### 4. Re: Need help getting min and max for combined data

Sorry, I had forgotten to click the Post button to post the attachment.

• ###### 5. Re: Need help getting min and max for combined data

Here it is:

Thanks

Deepak

If it Helps, pl mark it Helpful and CORRECt to Close Thread.

• ###### 6. Re: Need help getting min and max for combined data

That works great, but now I need it to work with 2 quick filters.  I want to filter on the Dept. and Date (see below).  When I filter out some of the dates and departments the numbers are not correct.

I really appreciate your help with this.

Thanks!

• ###### 7. Re: Need help getting min and max for combined data

You need to add filters to Context as it is FIXED LOD...Gets evaluated at the top..Add Filters to CONTEXT

• ###### 8. Re: Need help getting min and max for combined data

I was not aware of context filters.  I turned added them and everything is working great.

Thanks for the awesome help and quick replies!