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

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

Reply
shaebert
Helper III
Helper III

Need Help with nested IF statements comparing text values between columns.

Hello! I need help visualizing in a table visual the number of registrations per campaign, but then I need to slice on the account manager AND show campaigns with zero registrations if the campaign is the region is in the reps region. It's just the last part in my previous sentence that I can't figure out. I figure I have to write some IF statements to accomplish this. 

 

Below is sample data of the tables, what I am currently able to accomplish, and what I am trying to accomplish. 

 

Tables of data: "<--->" indicates the relationship key between the tables. 

Screen Shot 2023-05-20 at 9.37.31 AM.png

 

With the data above, I am only able to produce this:

Screen Shot 2023-05-20 at 10.01.37 AM.png

 

My goal is to produce this, which I need help with:

Screen Shot 2023-05-20 at 10.01.31 AM.png

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @shaebert ,

 

I have modified the measure # Registered, please check:

# Registered = 
CALCULATE(COUNTROWS('Registration Table'),FILTER('AM Region Table',[Rep]=SELECTEDVALUE('REP'[Rep])))+0

 

vjianbolimsft_0-1684979209282.png

vjianbolimsft_1-1684979225811.png

 

 

Best Regards,

Jianbo Li

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

4 REPLIES 4
v-jianboli-msft
Community Support
Community Support

Hi @shaebert ,

 

I have modified the measure # Registered, please check:

# Registered = 
CALCULATE(COUNTROWS('Registration Table'),FILTER('AM Region Table',[Rep]=SELECTEDVALUE('REP'[Rep])))+0

 

vjianbolimsft_0-1684979209282.png

vjianbolimsft_1-1684979225811.png

 

 

Best Regards,

Jianbo Li

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

Thank you for your help @v-jianboli-msft ! When I transferred to the live report, I had to include an additional workaround to make it work with some other variables that weren't in the sample data, but I got it to work. 

v-jianboli-msft
Community Support
Community Support

Hi @shaebert ,

 

Please try:

First create a new table for Rep:

vjianbolimsft_0-1684734045620.png

Note: This table do not have any relationship with other table

Then use it create a slicer

Apply the measure flag to the table visual's filter:

Flag = 
var _a = SELECTCOLUMNS(FILTER('AM Region Table',[Rep] in ALLSELECTED(REP[Rep])),"Region",[Region])
var _b = CALCULATETABLE(SELECTCOLUMNS('Campaign Location Table',"Region",[Region]),FILTER('AM Region Table',[Rep] in ALLSELECTED(REP[Rep])))
var _c = UNION(_a,_b)
return IF(SELECTEDVALUE('Campaign Location Table'[Region]) in _c,1)

vjianbolimsft_1-1684735620516.png

Apply this measure:

# Registered = COUNTROWS('Registration Table')+0

Final output:

vjianbolimsft_2-1684735675783.png

Best Regards,

Jianbo Li

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

Hi @v-jianboli-msft - thanks for your help. I was having issues trying to get your sample file to match mine, but I figured out the issue, I had to adjust the relationship direction between two of the tables. Once I did that, I was able to replicate what you shared. 

 

When the slicer is filtered on Mike C, it works perfectly. But when it is sliced on other reps, it doesn't show what it is supposed to. Below is what the other data should look like. Any thoughts?

 

*note that in the Campaign Location Table Campaign4's region in my sample date was "WA," in the sample you provided it said "WI," which is fine, I updated mine to reflect the same. Just want to make sure you're aware.


Screen Shot 2023-05-24 at 11.13.14 AM.png

 

Screen Shot 2023-05-24 at 11.14.22 AM.png

 

Screen Shot 2023-05-24 at 11.13.43 AM.png

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.