Forum Discussion

Top006's avatar
Top006
Frequent Visitor
5 years ago
Solved

Using a parameter in desktop

Hello everyone,

 

Hope someone can assist with my parameter issue which is causing a lot of headache.

 

I have two tables; (A) with three ID's and three products for each, and (B) which a discount at a given qty supplied:

TABLE A
IDProductCost1
AX48
AY50
AZ24
BX25
BY50
BZ45
CX31
CY46
CZ35

 

TABLE B
IDSupplied qtyDiscount
A10-3
A20-8
A30-20
A40-8
A50-15
A60-20
A700
B10-14
B20-17
B30-16
B40-1
B50-7
B60-16
B70-4
C10-6
C20-5
C30-17
C40-14
C50-7
C60-3
C70-18


What I would like to do is to enable the report reader to adjust the supplied qty by using a parameter and then have a calculated table showing the new cost (2) i.e. if supplied qty is set to 10:

Cost2
ID \ ProductXYZ
A454721
B113631
C254029

 

and if set to 50:

Cost2
ID \ ProductXYZ
A33359
B184338
C243928

 

I have created a parameter in Power BI (GENERATESERIES(10; 70; 10)) which can be used to show the discount for each ID according to the given qty in the parameter in a table. However, I can't figure out how to calculate the new cost as shown above.

 

Any ideas please?

 

Thanks

  • Top006 , You need have common table ID

     

    measure =
    var _value = selectedvalue(series[value])
    return
    sum(TableA [Cost]), calculate(Sum(TableB[Discount]), filter(TableB, TableB[ID] = Max(ID[ID]) && TableB[Supplied qty] =_value))

     

    Bridge Table https://youtu.be/Bkf35Roman8

2 Replies

  • Top006 , You need have common table ID

     

    measure =
    var _value = selectedvalue(series[value])
    return
    sum(TableA [Cost]), calculate(Sum(TableB[Discount]), filter(TableB, TableB[ID] = Max(ID[ID]) && TableB[Supplied qty] =_value))

     

    Bridge Table https://youtu.be/Bkf35Roman8

    • Top006's avatar
      Top006
      Frequent Visitor

      Thank you very much amitchandak !!! This works excatly as intended..

       

      Much appreciated 🙂