Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago

Calculated column based on date slicer selection

Hi folks,

 

I just read the following article (http://community.powerbi.com/t5/Community-Knowledge-Base/Calculated-Column-Table-Change-Dynamically-According-to-Slicer/ta-p/163321) which makes me believe what I am trying to do is not possible but nevertheless, I'll ask :)

 

I have one table (Transactions) with multiple transactions which include 11 columns with different possible manufacturers, a "Total Price" for each line and a transaction date.

 

I have another table (Manufacturer) where I have a distinct list of all manufacturers and I'd like to have against them, a sum of the "Total Price" to plot. The catch is that I'd like to use the Transaction Date of the first table as a slicer, and after hours of trying, I'm close to giving up.

 

At the moment, my calculated column is based on the following:

 

Total Spend = CALCULATE (
SUM(Transactions[TOTAL PRICE]),
FILTER(Transactions,Transactions[Related Manufacturer 1]=Manufacturer[Manufacturer]||Transactions[Related Manufacturer 2]=Manufacturer[Manufacturer]||Transactions[Related Manufacturer 3]=Manufacturer[Manufacturer]||Transactions[Related Manufacturer 4]=Manufacturer[Manufacturer]||Transactions[Related Manufacturer 5]=Manufacturer[Manufacturer]||Transactions[Related Manufacturer 6]=Manufacturer[Manufacturer]||Transactions[Related Manufacturer 7]=Manufacturer[Manufacturer]||Transactions[Related Manufacturer 8]=Manufacturer[Manufacturer]||Transactions[Related Manufacturer 9]=Manufacturer[Manufacturer]||Transactions[Related Manufacturer 10]=Manufacturer[Manufacturer]||Transactions[Related Manufacturer 11]=Manufacturer[Manufacturer]
)
)

Does anyone have any clever idea on how to filter the amount this calculation returns based on a slicer for a date on table1?

4 Replies

  • v-juanli-msft's avatar
    v-juanli-msft
    Community Support

    Hi Anonymous

    Since a calculated column can't be changed by a slicer, could you consider using measures instead?

     

    Best Regards

    Maggie

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Maggie,

       

      Yes completely but I am unable to convert the column formula I have in my first post into a measure? I am effectively testing whether my manufacturer number appears in any of the 11 columns. I also have one column that agreggates all columns (with "//" as a delimeter) but can't integrate a search or find within a measure :(

      • v-juanli-msft's avatar
        v-juanli-msft
        Community Support

        Hi Anonymous

        What are your tables like?

        I create an example, is it right?

        table1

         

        table2

         

        I am testing, if i have misunderstood you, please let me know in time.

         

        Best Regards

        Maggie