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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
nj17
Helper III
Helper III

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
tex628
Community Champion
Community Champion

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
simrantuli
Continued Contributor
Continued Contributor

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.

Tahreem24
Super User
Super User

@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!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
tex628
Community Champion
Community Champion

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

@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.

tex628
Community Champion
Community Champion

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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