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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Drake1002
Frequent Visitor

Using measure as advanced filter

I have a column 'a' with delimiter comma in a table A. I need to choose data based on the single value selected from the column with delimiter.

 

My approach is creating a B list/ table with distinct values from the column 'a' and then making a measure as

Selected=SELECTEDVALUE(B[b])

 

Now adding this measure to a table visual does not work in advanced filtering 

1 ACCEPTED SOLUTION

Hi @Drake1002 

 

Try this measure which can choose up to 3 values:

Measure 2 = 
	VAR _slicer = CONCATENATEX(
		'Table B',
		'Table B'[Column b]
	)
	RETURN
		IF(
			COUNT('Table B'[Column b]) = 1 && FIND(
				MID(
					_slicer,
					1,
					1
				),
				SELECTEDVALUE('Table A'[Column a]),
				,
				BLANK()
			) <> BLANK(),
			_slicer,
			IF(
				COUNT('Table B'[Column b]) = 2 && FIND(
					MID(
						_slicer,
						1,
						1
					),
					SELECTEDVALUE('Table A'[Column a]),
					,
					BLANK()
				) <> BLANK() && FIND(
					MID(
						_slicer,
						2,
						1
					),
					SELECTEDVALUE('Table A'[Column a]),
					,
					BLANK()
				) <> BLANK(),
				_slicer,
				IF(
					COUNT('Table B'[Column b]) = 3 && FIND(
						MID(
							_slicer,
							1,
							1
						),
						SELECTEDVALUE('Table A'[Column a]),
						,
						BLANK()
					) <> BLANK() && FIND(
						MID(
							_slicer,
							2,
							1
						),
						SELECTEDVALUE('Table A'[Column a]),
						,
						BLANK()
					) <> BLANK() && FIND(
						MID(
							_slicer,
							3,
							1
						),
						SELECTEDVALUE('Table A'[Column a]),
						,
						BLANK()
					) <> BLANK(),
					_slicer
				)
			)
		)

The result is as follow:

vzhengdxumsft_0-1713163319937.pngvzhengdxumsft_1-1713163329857.pngvzhengdxumsft_2-1713163339016.png

Best Regards

Zhengdong Xu
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
Drake1002
Frequent Visitor

Table A 

Column a

A,B,X

A,V,B

B,C,G

B,H,R

M,A,C

Z,C,B

 

Table B

Column b

A

B

C

X

V

G

H

R

M

Z

 

If i select A in the slicer then output visual be

A,B,X

A,B,V

M,A,C

Hi @Drake1002 

 

Please try this:

First of all, I add a measure:

MEASURE =
VAR _Slicer =
    SELECTEDVALUE ( 'Table B'[Column b] )
RETURN
    IF (
        FIND ( _Slicer, SELECTEDVALUE ( 'Table A'[Column a] ),, BLANK () ) <> BLANK (),
        _Slicer
    )

 Then create a table visual like this:

vzhengdxumsft_0-1713144755914.png

The result is as follow:

vzhengdxumsft_1-1713144778969.pngvzhengdxumsft_2-1713144785457.pngvzhengdxumsft_3-1713144794315.png

 

Best Regards

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

Thanks Zhengdong Xu. What if i want to select A and B both and it should display values having either A or B?

Hi @Drake1002 

 

Try this measure which can choose up to 3 values:

Measure 2 = 
	VAR _slicer = CONCATENATEX(
		'Table B',
		'Table B'[Column b]
	)
	RETURN
		IF(
			COUNT('Table B'[Column b]) = 1 && FIND(
				MID(
					_slicer,
					1,
					1
				),
				SELECTEDVALUE('Table A'[Column a]),
				,
				BLANK()
			) <> BLANK(),
			_slicer,
			IF(
				COUNT('Table B'[Column b]) = 2 && FIND(
					MID(
						_slicer,
						1,
						1
					),
					SELECTEDVALUE('Table A'[Column a]),
					,
					BLANK()
				) <> BLANK() && FIND(
					MID(
						_slicer,
						2,
						1
					),
					SELECTEDVALUE('Table A'[Column a]),
					,
					BLANK()
				) <> BLANK(),
				_slicer,
				IF(
					COUNT('Table B'[Column b]) = 3 && FIND(
						MID(
							_slicer,
							1,
							1
						),
						SELECTEDVALUE('Table A'[Column a]),
						,
						BLANK()
					) <> BLANK() && FIND(
						MID(
							_slicer,
							2,
							1
						),
						SELECTEDVALUE('Table A'[Column a]),
						,
						BLANK()
					) <> BLANK() && FIND(
						MID(
							_slicer,
							3,
							1
						),
						SELECTEDVALUE('Table A'[Column a]),
						,
						BLANK()
					) <> BLANK(),
					_slicer
				)
			)
		)

The result is as follow:

vzhengdxumsft_0-1713163319937.pngvzhengdxumsft_1-1713163329857.pngvzhengdxumsft_2-1713163339016.png

Best Regards

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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.