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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

select coulmns as per slicer value

Hi Team,

 

I have 2 tables in the backend: 

 

Country Compliant Full
US4
Ind11

 

Country YearCompliant Year
US20203
US20210
Ind20201
Ind20212

 

I have simple power bi report in which there are 2 slicers : Country and Year and in table visual i wanted to show 2 columns 

Country and Compliant

 

 when user filter only on Country then 2nd column should show value from Compliant full and when user chooses Country + Year or Just year then 2nd column should show value from Compliant Year. 

 

I used belwo DAX measure Compliant = IF(HASONEVALUE(Table2(Year), SUM(Compliant year), SUM(Compliant Full)) 

 

But it is giving me incorrect result in the Total of the table. 

 

Could you please help me on this ?

 

Thanks,

Shubham

 

 

 

1 ACCEPTED SOLUTION

@Anonymous , Problem That tell why we need calculate in SUMX

Measure = sumx(values(Country[country]), CALCULATE(IF(HASONEVALUE(Table2[Year]), SUM(Table2[Compliant year]), SUM(Table1[Compliant Full]))))

 

Please find the file after signature

 

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

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

It worked !! Thank you so much bhai !!

@Anonymous , Please accept the appropriate solution.

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
ryan_mayu
Super User
Super User

@Anonymous 

maybe you can try this

Measure = if(ISFILTERED('Table (2)'[Year]),SUM('Table (2)'[Compliant Year]),sum('Table'[Compliant Full]))

1.PNG2.PNG

please see the attachment below

 





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

Proud to be a Super User!




amitchandak
Super User
Super User

@Anonymous , First on all create a common table country and use that in visual and have measure like

 

Country = distinct(Distinct(Table[Country]), distinct(Table2[country]))

https://youtu.be/Bkf35Roman8

 

sumx(Country, IF(HASONEVALUE(Table2(Year)), SUM(Table2[Compliant year]), SUM(Table1[Compliant Full])))

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

@amitchandak Yes..but the total is not working 

Capture.PNG

@Anonymous , Try this small change

 

sumx(values(Country[country]), IF(HASONEVALUE(Table2(Year)), SUM(Table2[Compliant year]), SUM(Table1[Compliant Full])))

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

No. Still it is giving same result. 

@Anonymous , Problem That tell why we need calculate in SUMX

Measure = sumx(values(Country[country]), CALCULATE(IF(HASONEVALUE(Table2[Year]), SUM(Table2[Compliant year]), SUM(Table1[Compliant Full]))))

 

Please find the file after signature

 

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.