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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Vishruti
Helper I
Helper I

Measure to exclude rows based on multiple columns

I have following type of data where for one project, and its one market there may be multiple Parcels Types or a single Parcel Type.

 

When I plot this data in Power BI visual, I want to retain only those rows where for one project ID and its market there are two Parcel Types (like all rows highlighted in red below)

IMG_2721.jpeg

How can I achieve this? I was hoping to get assistance with a measure that I can add as a filter on the visual.

2 ACCEPTED SOLUTIONS
sevenhills
Super User
Super User

See this approach by creating the measure and applying filter:

 

 

Multiple Rows Project ID = 
var _a = CALCULATE( COUNTROWS(), ALLEXCEPT( 'Table', 'Table'[Project ID], 'Table'[Market]))
RETURN IF(_a > 1, 1, BLANK())

 

 

sevenhills_0-1737746267734.png

 

Optional: Create another measure to know the count

 

 

Count Rows Project ID - Market =  
CALCULATE( COUNTROWS(), ALLEXCEPT( 'Table', 'Table'[Project ID], 'Table'[Market]))

 

 

 

Hope it helps!

View solution in original post

Hi @Vishruti 

 

Here is another measure / example.

 

Flag = 
	MAXX(
		ADDCOLUMNS(
			SUMMARIZE(
				'ProjectsData',
				[Project ID],
				[Market]
			),
			"__Cnt", CALCULATE( DISTINCTCOUNT( 'ProjectsData'[Parcel Types] ) )
		),
		[__Cnt]
	) > 1

 

It will return TRUE for any combinations that have more than 1 Parcel Type.  If there is only 1 Parcel Type then it will return FALSE.

Let me know if you have any questions.

 

View solution in original post

3 REPLIES 3
sevenhills
Super User
Super User

See this approach by creating the measure and applying filter:

 

 

Multiple Rows Project ID = 
var _a = CALCULATE( COUNTROWS(), ALLEXCEPT( 'Table', 'Table'[Project ID], 'Table'[Market]))
RETURN IF(_a > 1, 1, BLANK())

 

 

sevenhills_0-1737746267734.png

 

Optional: Create another measure to know the count

 

 

Count Rows Project ID - Market =  
CALCULATE( COUNTROWS(), ALLEXCEPT( 'Table', 'Table'[Project ID], 'Table'[Market]))

 

 

 

Hope it helps!

rohit1991
Super User
Super User

Hi, @Vishruti 

To filter rows where each Project ID and Market combination has exactly two Parcel Types:

  1. Create a Measure in Power BI: RowsWithTwoParcelTypes =
    VAR ParcelTypeCount =
    CALCULATE( DISTINCTCOUNT(ProjectsData[Parcel Types]),
    ALLEXCEPT(ProjectsData, ProjectsData[Project ID], ProjectsData[Market]))
    RETURN
    IF(ParcelTypeCount = 2, 1, 0)

  2. Apply as Filter:

    • Add the measure to the visual filter paane.
    • Set the filter condition to show only rows where RowsWithTwoParcelTypes = 1.

Hi @Vishruti 

 

Here is another measure / example.

 

Flag = 
	MAXX(
		ADDCOLUMNS(
			SUMMARIZE(
				'ProjectsData',
				[Project ID],
				[Market]
			),
			"__Cnt", CALCULATE( DISTINCTCOUNT( 'ProjectsData'[Parcel Types] ) )
		),
		[__Cnt]
	) > 1

 

It will return TRUE for any combinations that have more than 1 Parcel Type.  If there is only 1 Parcel Type then it will return FALSE.

Let me know if you have any questions.

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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