Forum Discussion

mkornel's avatar
mkornel
Frequent Visitor
6 years ago
Solved

Slicers Don't Work

Hi all,

 

I need help to create formula which would be responsive to slicers.

|Date|Store|Prodcut|Qty|

|Feb-1|A|A|10|

|Feb-1|A|B|20|

|Feb-1|A|C|30|

|Feb-1|A|D|40|

|Feb-2|B|A|1|

|Feb-2|B|B|2|

|Feb-2|B|C|3|

|Feb-2|B|D|4|

 

FORMULA = (SUM(Product A) + SUM(Product B)) / (SUM(Product C) + SUM(Product D))

I have two slicers: Store and Product. Store is working, but Product is not. I guess its because I'm using it as a part of the formula, but I don't know how to fix this.

 

I would appreciate any help here! Thanks in advance!

  • Ok. See if this is what you want. See the attached PBIX file. Please note the formula will not work unless you have Pen and/or Pencil selected and Paper and/or Notebook. In other words, if you only select Pen and Pencil, the formula returns nothing because there is no denominator. 

3 Replies

  • edhans's avatar
    edhans
    Icon for Community Champion rankCommunity Champion

    Can you explain exactly what it is you are doing? Your formula isn't valid. SUM() requires a column name, and Product A, Product B, etc. are not column names.

    Slicers will definitly work if you are using fields in your table as measures. I just need to understand your goal here.

    • mkornel's avatar
      mkornel
      Frequent Visitor

      Sorry for being too vague.

       

      See dataset.

      DateStoreProductAmount
      Feb-1APen10
      Feb-1APencil20
      Feb-1ANotebook30
      Feb-1APaper40
      Feb-1BPen10
      Feb-1BPencil20
      Feb-1BNotebook30
      Feb-1BPaper40

      ...

      EXCEL FORMULA = ( SUMIF(Product,"Pen",Amount) + SUMIF(Product,"Pencil",Amount) ) / ( SUMIF(Product,"Notebook",Amount) + SUMIF(Product,"Paper",Amount) )

       

      GOAL - I want to have two slicers: store and product. Both should affect formula, e.g. unselecting "Pen" should set 0 amount in formula for "Pen"

      • edhans's avatar
        edhans
        Icon for Community Champion rankCommunity Champion

        Ok. See if this is what you want. See the attached PBIX file. Please note the formula will not work unless you have Pen and/or Pencil selected and Paper and/or Notebook. In other words, if you only select Pen and Pencil, the formula returns nothing because there is no denominator.