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
SBR1D
Helper I
Helper I

Filter table to records which have two status's

Hi All

 

I am trying to filter a table to get records that have had two specific status's ( 2 and 9), sample data is below.

 

So the ID's that match the criteria are 1, 2 , and 4.

 

Thanks in advance.

 

IDStatusDateupdated
1201/03/2019
2206/03/2019
3112/12/2018
4227/07/2019
5430/05/2019
1915/05/2019
2921/06/2019
3405/06/2019
4914/09/2019
5811/02/2019
11002/11/2019
4903/10/2019
51019/11/2019
1 ACCEPTED SOLUTION
KNP
Super User
Super User

What is your preferred solution, Power Query or DAX?

 

In Power Query (I suspect this is not what you meant):

paste this into the advanced editor of a blank query.

let
  Source = Table.FromRows(
    Json.Document(
      Binary.Decompress(
        Binary.FromText(
          "ZY/BDcAgDAN34V0pToAWZkHsv0Yd1IpGleBzMecwRtJ0JOOFCrIYtKd5jIUWPgPORP5CTXiI28LlSdsluHa6EvkoQ1A3dkF3SQ3YHmzc5IyVLmH0i8srKYIeK5tjSixWKtzCxfVv4R8V0bLi2nd83g==",
          BinaryEncoding.Base64
        ),
        Compression.Deflate
      )
    ),
    let
      _t = ((type nullable text) meta [Serialized.Text = true])
    in
      type table [ID = _t, Status = _t, Dateupdated = _t]
  ),
  #"Filtered Rows" = Table.SelectRows(Source, each ([Status] = "2" or [Status] = "9"))
in
  #"Filtered Rows"

 

In DAX you could create this filter as a measure and use it to filter the visual.

	filter = 
		SWITCH(
			TRUE(),
			SELECTEDVALUE(Table[Status]) IN {2, 9}, 1
		)

 

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

View solution in original post

2 REPLIES 2
SBR1D
Helper I
Helper I

Thank you!

The DAX solution was what i was looking for.

Have a great day

KNP
Super User
Super User

What is your preferred solution, Power Query or DAX?

 

In Power Query (I suspect this is not what you meant):

paste this into the advanced editor of a blank query.

let
  Source = Table.FromRows(
    Json.Document(
      Binary.Decompress(
        Binary.FromText(
          "ZY/BDcAgDAN34V0pToAWZkHsv0Yd1IpGleBzMecwRtJ0JOOFCrIYtKd5jIUWPgPORP5CTXiI28LlSdsluHa6EvkoQ1A3dkF3SQ3YHmzc5IyVLmH0i8srKYIeK5tjSixWKtzCxfVv4R8V0bLi2nd83g==",
          BinaryEncoding.Base64
        ),
        Compression.Deflate
      )
    ),
    let
      _t = ((type nullable text) meta [Serialized.Text = true])
    in
      type table [ID = _t, Status = _t, Dateupdated = _t]
  ),
  #"Filtered Rows" = Table.SelectRows(Source, each ([Status] = "2" or [Status] = "9"))
in
  #"Filtered Rows"

 

In DAX you could create this filter as a measure and use it to filter the visual.

	filter = 
		SWITCH(
			TRUE(),
			SELECTEDVALUE(Table[Status]) IN {2, 9}, 1
		)

 

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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