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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
lmmnnaa
Frequent Visitor

Dynamic value based on selection

Hi, 

 

I want to create a Calculated Column where the value is 0 or 1 depending on where the value on Column 1 exists on Table2.Column1 only for the selected Customer.

 

For example: Customer A has value E and Customer B has value F on Table2, so if Customer A is selected on slicer, the calculated column should show  1 next to value E and 0 next to value F. 

 

Thanks 

 

A.

4 REPLIES 4
Anonymous
Not applicable

Try to create a table crossing all information:

 

CrossTable = CROSSJOIN( DISTINCT(Table2[Customer]) ; DISTINCT(Table2[Value]) )

And Then, in the "CrossTable" you create a column with the Flag "0 or 1" comparing with the table2

 

Flag = IF(
ISBLANK(LOOKUPVALUE( Table2[Value];Table2[Customer];CrossTable[Customer];Table2[Value];CrossTable[Value]))
;0
;1)

Hi, thanks for your quick answer. The issue I find is that the cross join is not dynamic, so I'm stuck with the same result for every customer I select. Maybe I didn't do it correctly as I'm new to Power Bi.

 

Again, thanks

 

Regards

 

A.

Vvelarde
Community Champion
Community Champion

@lmmnnaa

 

Create a measure:

 

Count = IF(COUNTROWS(Table1)=0;0;COUNTROWS(Table1))

 

In a table visual:

Select Column Customer from Table 2 and the measure.

The slicer is filled with Customer from Table Customer

 

SS.png




Lima - Peru

Hi, thanks for the answer. This works for me on one table but not on the other.

 

 https://drive.google.com/file/d/0B4UTibWsnMtMZ1U5Q1VhWEVJZFk/view?usp=sharing

 

Any clue?

 

Thanks

 

A.

 

 

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.