3 Replies Latest reply on Oct 9, 2018 4:57 AM by Mahfooj Khan

    Filter in (nested) LoD Expression

    Sebastian Schäfer

      I have a three dimensional data set indicating that an article was sold at a certain shop during a given time period:

       

      Data = (article, shop, period)

       

      Now I would like to know the number of articles sold in a particular period (e.g. year 2017) at more than 10 different shops.

       

      This SQL will yield the desired result:

       

      select count(*)
      from (
      select
        article,
        count(distinct shop) as shop_count
      from Data
      where period = 2017
      group by article)
      where shop_count > 10;

      Now I tried to compose an LoD Expression in Tableau to get the same result, but I failed in combining the period filter with COUNTD()
      I also cannot use the filter bucket since I want to combine this measure with others spanning different periods.

       

      I attached a simple data set with the objective to retrieve the number of different articles sold in period 1 or 2 by at least 3 shops (which is true for article 1 & 2 => 2 in total).