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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
krkumar2
Frequent Visitor

Keep the context/filter while doing total of a measure

I have below measure Current Billing Final . It is working as expcted  when I keep this in a table with PARTNER_NAME. But as soon as I remove PARTNER_NAME to get total of Current Billing Final, it shows total  of [Current Billing 2] i.e- It is not consudering the context 'SP List'[PARTNER_NAME]) in {"XYZ"} which is understood.

 

Current Billing Final  = IF(SELECTEDVALUE('SP List'[PARTNER_NAME]) in {"XYZ"}, [Current Billing 1],[Current Billing 2])

 

How can I get Total of Current Billing Final  even fi I have to create a new measure???

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@krkumar2 , Try like

Current Billing Final = Sumx(Values('SP List'[PARTNER_NAME]),IF(SELECTEDVALUE('SP List'[PARTNER_NAME]) in {"XYZ"}, [Current Billing 1],[Current Billing 2]))

 

Also refer

https://www.youtube.com/watch?v=ufHOOLdi_jk

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

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

I do not understand your requirement.  As per the formula, if the partner name id XYZ, then show the result of the measure Current Billing 1 else show the result of Current Billing 2.  If you do not have Partner name in the visual and neither are you selecting it in the slicer, the obviously you will get the result of Current Billing 2.

Share some data, describe the question and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@krkumar2 , Try like

Current Billing Final = Sumx(Values('SP List'[PARTNER_NAME]),IF(SELECTEDVALUE('SP List'[PARTNER_NAME]) in {"XYZ"}, [Current Billing 1],[Current Billing 2]))

 

Also refer

https://www.youtube.com/watch?v=ufHOOLdi_jk

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

Thanks a lot ,

 

I derived a new measure tha way it was suggested in video which works perfectly fine 

 

Right Current Billing Final= IF(HASONEVALUE('SP List'[PARTNER_NAME]), [Current Billing Final],SUMX(VALUES('SP List'[PARTNER_NAME]),[Current Billing Final]))

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors