5 Replies Latest reply on Jun 26, 2019 8:34 AM by Clara Gonzalez Ginestet

    LOD date time

    Clara Gonzalez Ginestet

      Hi,

       

      I was doing a lot of thinking about the best way to show the number of open email by weekday. First, I applied LOD expression. However, when the filter of the DB were appplied such as Country, brand, it would mot work and it over estimated the calculation.

       

      The chart below shows the different metrics.

       

       

       

       

       

      c_ [fixed Datepart("year", activity date), Datepart("month", activity date) , Datepart("weekday", activity date): countd(if activity= "Opened" then sent email name end ) }

       

      Thanks in advance for your help!

       

      Clara

        • 1. Re: LOD date time
          swaroop.gantela

          Clara,

           

          I didn't get a good view of your filter shelf, so I may be wrong,

          but I think you may need to add most of them to "Context"

          so that the LOD knows what to take into account:

          Improve View Performance with Context Filters - Tableau

          • 2. Re: LOD date time
            Clara Gonzalez Ginestet

            I am posting the table matrix, which compares the different metrics.

             

            Thanks again,

            fixed 1.pngfixed 2.png

            • 3. Re: LOD date time
              Clara Gonzalez Ginestet

              Thanks for your help!

               

              After applying context with fixed metrics, the data looks good. However, I am wondering  just wonder when it is better to apply context and Fixed or Included (without applying Context). What is the difference?

               

              1- Delivered: COUNTD( if [Status]= 'Delivered' then  [Email id]

              END)

               

              2- Delivered- Created Month:

              { FIXED

              DATEPART('year', [Created Date]),DATEPART('month', [Created Date]):

              COUNTD( if [Status]= 'Delivered' then  [Email id]

              END)

              }

               

               

              3- Delivered- Created Month (copy):

              { INCLUDE

              DATEPART('year', [Created Date]),DATEPART('month', [Created Date]):

              COUNTD( if [Status]= 'Delivered' then  [Email Id]

              END)

              }

               

              Thanks a lot!

               

               

               

              fixed.png

              • 4. Re: LOD date time
                swaroop.gantela

                Clara,

                 

                Hopefully others will add more detail to this discussion,

                but from a practical perspective, it feels to me, though I may be wrong,

                that for your worksheet, if you added all the needed fields to your LOD calculation, like:


                {FIXED [Specialty],[Country],[Brand],[Strategic Segment] … : SUM(measure)}

                 

                it should likely produce the same result as adding them to context.

                Practically, people may have many more things on the filter shelf,

                and so it's easier to just add to context then to type them all in.

                There are likely other more technical advantages/disadvantages to each.

                 

                It is possible however for some setups that context filters may actually

                make performance slower. (Though with others, it may improve performance).

                Will need to test that out.

                 

                Here's a thread discussing it further:

                Should I use FIXED or INCLUDE/EXCLUDE?

                 

                Below is some other explanations from this link:

                Overview: Level of Detail Expressions - Tableau

                 

                FIXED calculations are applied before dimension filters, so unless you promote the fields on your Filter shelf to Improve View Performance with Context Filters, they will be ignored.

                 

                INCLUDE and EXCLUDE level of detail expressions are considered after Dimension filters. So if you want filters to apply to your FIXED level of detail expression but don’t want to use Context Filters, consider rewriting them as INCLUDE or EXCLUDE expressions.

                1 of 1 people found this helpful
                • 5. Re: LOD date time
                  Clara Gonzalez Ginestet

                  Ok, it is clear.

                   

                  But, what happen if  you need to do several calculations:

                   

                  1- SUM([Sales]) / ATTR({SUM([[Sales])})

                  and having the dimension [State] in your Sheet. With this setup, this calculation will give you ratio of a State’s sales to total Sales. You can add a filter to your Sheet to hide some of the States but filter will only affect the numerator.

                  2- In another sheet, you have a fixed calculation and state is as a context as you need to know the sales per each order date, and state a filter select to apply some worksheets

                  {Fixed  [order date] : SUM([[Sales])}

                  In this scenario, what it will be better to apply?