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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Using sumx to create filter on the lowest level that works on a aggregated level

Hi all!

I am trying to design a filter via DAX that on the loweset level (transaction) is doing a search for a substring within a columns stringvalue. I need to do this as a measure, and not a calculated column since the Substring is a variable that is selected in the report, hence it cannot be a computed column.

I have come up with the solution below.

  • For every row, search for Substring in ConcatenatedListofCars.
  • If Substring is found, return a 1, otherwise return a 0.
  • SUMX to sum all rows up.
  • Use Myfilter=1 as filter in PBI.

 

This approach works very well when it comes to a reports that shows data on transaction level.

 

However, it does not always work in a report that is showing data on a aggregated level.
That is propably due to the fact that I am using FIRSTNONBLANK on ConcatenatedListOfCars and therefor, depending on the reports design (and aggregationlevels), sometimes gets the wrong ConcatenatedListOfCars. I always want to compare the Substring to the current row ConcatenatedListOfCars.

 

Any ideas or hints on this one?
BR:
// Michael

 

Example DAX:

Myfilter:=

Var Substring = "Volvo"

Var Result =

IF (

    SUMX (

                                                          'FactTable';

                                                          SEARCH(Substring;CALCULATE(FIRSTNONBLANK(VALUES('FactTable'[ConcatenatedListOfCars]);1) );;0)

                             )

        > 0;

   1;

    0

)

 

Return Result

0 REPLIES 0

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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