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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

How to get data using slicer in dax calculartion

Hello All,

 

I have a table where I have data like below.

 

CountrySales
India45000
India45000
India20000
UK17000
UK18000
Uk19000
Canada2000
Canada25000

 

Now as per my requirement I created a table inside power bi with values EMEA,West and APAC

 

Now my requirement is I have took a slicer with the table values APAC ,EMEA and West

If I select slicer value as APAC then it has to show India sales 

and If I select EMEA it has to show UK sales

and If I select West it has to show Canada sales

 

Could any one help what is the dax function used here 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

According to your description, modify the formula like this:

Check =
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'Slicer Table'[Slicer] ) = "APAC"
        && SELECTEDVALUE ( 'Table'[Country] ) = "India", 1,
    SELECTEDVALUE ( 'Slicer Table'[Slicer] ) = "EMEA"
        && SELECTEDVALUE ( 'Table'[Country] ) = "UK", 1,
    SELECTEDVALUE ( 'Slicer Table'[Slicer] ) = "West"
        && SELECTEDVALUE ( 'Table'[Country] ) = "Canada", 1,
    SELECTEDVALUE ( 'Slicer Table'[Slicer] ) = BLANK (), 1,
    SELECTEDVALUE ( 'Slicer Table'[Slicer] ) = "Overall", 1,
    0
)

Get the result.

vkalyjmsft_0-1652838859090.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

Create a 2 column table with column for Country and Region.  In your dataset (Table1), write this calculated column formula

Region = lookupvalue('table2'[region],'table2'[Country],'table1'[Country])

To your visual, drag Region from Table1.  Write this measure

Revenue = sum(Table1[Sales])

Hope this helps. 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

According to your description, I create a sample.

Table:

vkalyjmsft_0-1652771180182.png

Slicer Table:

vkalyjmsft_1-1652771202463.png

Here's my solution, create a measure.

Check =
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'Slicer Table'[Slicer] ) = "APAC"
        && SELECTEDVALUE ( 'Table'[Country] ) = "India", 1,
    SELECTEDVALUE ( 'Slicer Table'[Slicer] ) = "EMEA"
        && SELECTEDVALUE ( 'Table'[Country] ) = "UK", 1,
    SELECTEDVALUE ( 'Slicer Table'[Slicer] ) = "West"
        && SELECTEDVALUE ( 'Table'[Country] ) = "Canada", 1,
    SELECTEDVALUE ( 'Slicer Table'[Slicer] ) = BLANK (), 1,
    0
)

Put the measure in the visual filter and let its value to 1.

vkalyjmsft_2-1652771359453.png

Get the correct result.

vkalyjmsft_3-1652771384031.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @v-yanjiang-msft ,

 

Thanks for your response.

I need to add another value (Overall) in slicer table which should show all countires data when I select overall.

 

So If I select Overall then I need to show Inda,Canada and UK data

 

Could you please provide the dax for this

Hi @Anonymous ,

According to your description, modify the formula like this:

Check =
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'Slicer Table'[Slicer] ) = "APAC"
        && SELECTEDVALUE ( 'Table'[Country] ) = "India", 1,
    SELECTEDVALUE ( 'Slicer Table'[Slicer] ) = "EMEA"
        && SELECTEDVALUE ( 'Table'[Country] ) = "UK", 1,
    SELECTEDVALUE ( 'Slicer Table'[Slicer] ) = "West"
        && SELECTEDVALUE ( 'Table'[Country] ) = "Canada", 1,
    SELECTEDVALUE ( 'Slicer Table'[Slicer] ) = BLANK (), 1,
    SELECTEDVALUE ( 'Slicer Table'[Slicer] ) = "Overall", 1,
    0
)

Get the result.

vkalyjmsft_0-1652838859090.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

amitchandak
Super User
Super User

@Anonymous , Please create a new column based on country and use that in slicer

 

Region =

Switch( [Country],

"India", "APAC",

"UK", "EMEA",

"Canada", "West")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @amitchandak ,

 

Should I call slicer values directly as you mentioned above.

Could you please let me know

Here the APAC ,EMEA and West values are coming from slicer

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors