cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Show different values in KPI based on selection from slicer

Hi All,

 

I have sales data in my dataset.

In power BI, I have 2 slicers,one having country(Japan) and another having sales vendor(BS,CO and SI).I have one measure which shows sum of sales in a KPI.Now I want to show sales only related to BS vendor when I do not select anything on slicer or while I select BS from vendor.While I select CO or SI then it should show sales related to this vendor.

How can I achieve this in a single KPI.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Super User II
Super User II

Something along the lines of this:

Measure =
SWITCH( HASONEFILTER( 'Vendor'[Name] ) ,
FALSE , [Sales BS] ,
TRUE , [Sales]
)


Sales BS being the normal sales measure with a filter on BS. 

Br,

J


Connect on LinkedIn

View solution in original post

6 REPLIES 6
Super User II
Super User II

Something along the lines of this:

Measure =
SWITCH( HASONEFILTER( 'Vendor'[Name] ) ,
FALSE , [Sales BS] ,
TRUE , [Sales]
)


Sales BS being the normal sales measure with a filter on BS. 

Br,

J


Connect on LinkedIn

View solution in original post

Super User II
Super User II

@nj17 ,

Try a below DAX:

Measure = CALCULATE(SUM(Table[Sales]),ALLEXCEPT(Table1,Table[VendorList]))

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!
You can follow me on LinkedIn

Please take a quick glance at newly created report:
My Report
Super User IV
Super User IV

@nj17 , need to have very similar code -https://radacad.com/change-the-column-or-measure-value-in-a-power-bi-visual-by-selection-of-the-slic...



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Frequent Visitor

@tex628for vendor i have different dim table so how can I create a measure in which BS can filter Sales data?I have different datasets for sales and vendor.

Responsive Resident
Responsive Resident

Hi,

 

You could use the below DAX to create your measure.

Measure = IF(
                      ISFILTERED([Sales Vendor])=FALSE(),
                      CALCULATE(SUM(Sales),FILTER('Vendor',[Sales Vendor]="BS")),
                      SUM(Sales)
)

Please note that I have assumed that 'Vendor' is the table name where you have the column 'Sales Vendor'.

Also, please make sure there's a relationship between Sales and Vendor tables.

Assuming there is a relationship between your sales table and your vendor table the calculation should look something like this:

Sales BS = Calculate([Sales] , 'Vendors'[Name] = "BS")


[Sales] being your normal sales measure. 

/ J


Connect on LinkedIn

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors