Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Decter3343
Frequent Visitor

Calculate each values in slicer selection

Hi.

 

Let me explain current my concern. 

please, find below picture.

Decter3343_0-1693888983862.png

 

there is two part. first, i select potential Vendor with slicer. if i select three vendors, i can find these vendors information with table. in this table, there is vendor information with score and last column is total number of score. there is no problem so far.

 

but problem is second part. each of vendor could have additional score.

its rule is not exist and it can be added base on judgement of person in charge. 

 

Is it possible to add each different additional score in parameters to each vendor selected in slicer? 

 

i try to make array with selected vendor. but it doesn't work. and i also try to make new table with selected vendor. but it also does not work. 

1 ACCEPTED SOLUTION

So for this you want to pick up 5 vendors and apply to those the parameters correct?

 

I assume you have a table for vendors (dimension and another with the fact tables and a measure that you are using to be changed. 

 

Create the following measure:

Total adjusted = 
VAR test =
    CALCULATE (
        COUNTROWS ( ALLSELECTED ( 'Vendors' ) ),
        FILTER (
            ALLSELECTED ( 'Vendors'[Vendor] ),
            'Vendors'[Vendor] <= MAX ( 'Vendors'[Vendor] )
        )
    )
RETURN
    SWITCH (
        test,
        1, [Total Sales]+ [Vendor1 Parameter Value],
        2, [Total Sales] + [Vendor 2 Parameter Value],
       [Total Sales]
    )

 

In this case I only have two but you can have 5 or more:

 

MFelix_0-1694000340219.pngMFelix_1-1694000363464.png

Check PBIX file attach.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

6 REPLIES 6
MFelix
Super User
Super User

Hi @Decter3343 ,

 

Not sure if I understand your question correctly but if you want to have additional values based on parameters for each vendor, you need to create a parameter table for each of your vendors then using the selected value has you were refering you can make the calculation of the new score.

 

The syntax for the new score would be similar to this:

New Score = SWITCH (SELECTEDVALUE(Table[Vendor]), 
                     1 , [Total Score] + [Parameter 1 value],
                     2 , [Total Score] + [Parameter 2 value],
                     3 , [Total Score] + [Parameter 3 value],
                     [Total Score])

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks for your kind explanation.  hope you understand that most of words are written by Korean in captured picture

 

As per your advice, i made it using "SWITCH"

In Dax Function "SWITCH", I put the "A company" and "B company" Condition with Parameter1, 2

and it works. if i change parameter1, score of A company only changed. and If i change parameter2, score of B company only chagned. 

 

However, there is another problem. basically, in the "SWITCH" Fuction, all of vendor condition should be written. but number of Vendors are almost 1,000. it is not possible to write all of vendor in the SWITCH for condition. 

 

is there any other way to write condition more easily? 

 

Decter3343_2-1693990773481.png

 

 

 

 

 

Hi @Decter3343 ,

 

In this case will you need to have a parameter for each of the vendors so in this case the 1000?


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Parameter is only for selected Vendors in slicer. 
in my case, maximum number of selected vendor is Five. 

therefore, only 5 parameter is required. 

 

but in slicer, there is almost 1,000 number of vendor is listed. 

 

below list is my work process

 

1. select potential vendor in the slicer (maximum 5)

2. selected vendor is listed in the table. 

3. most of scores are counted automatically.

4. addtional score will be added using parameter.

So for this you want to pick up 5 vendors and apply to those the parameters correct?

 

I assume you have a table for vendors (dimension and another with the fact tables and a measure that you are using to be changed. 

 

Create the following measure:

Total adjusted = 
VAR test =
    CALCULATE (
        COUNTROWS ( ALLSELECTED ( 'Vendors' ) ),
        FILTER (
            ALLSELECTED ( 'Vendors'[Vendor] ),
            'Vendors'[Vendor] <= MAX ( 'Vendors'[Vendor] )
        )
    )
RETURN
    SWITCH (
        test,
        1, [Total Sales]+ [Vendor1 Parameter Value],
        2, [Total Sales] + [Vendor 2 Parameter Value],
       [Total Sales]
    )

 

In this case I only have two but you can have 5 or more:

 

MFelix_0-1694000340219.pngMFelix_1-1694000363464.png

Check PBIX file attach.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thank you so much. it's exactly what i want.

I couldn't have dont it without your help. You are literally a super user.

Once again, thanks you very much. 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.