cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Frequent Visitor

## Need to compare multiple rows in the same table

Hello,

I need help with this problem. I have a table like this:
BRAND | CUSTOMER | VALUE
A | X | 1

A | Y | 1

B | X | 2

B | Y | 0

C | X | 1

C | Y | 1

C | Z | 0

Brand is a slicer in my page. Based on the combination of brands the user selects, I need to return a table which shows only the customer with a positive value (>0) for each and every selected Brand.

For example, if A & B are selected, the result should be:
CUSTOMER | VALUE

X | 3

While if A & C are selected:
X | 2
Y | 2

Eventually, I need to create measures to count the number of customers active in multiple brands, and the total value they generate.

Thank you,

alepagg

1 ACCEPTED SOLUTION
Community Support

Hi @alepagg ,

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a measure.

``````Flag =
var _table=CALCULATETABLE(VALUES('Table'[CUSTOMER]),'Table'[VALUE]<=0)
RETURN IF( not MAX('Table'[CUSTOMER]) in _table,1,0)``````

(3) Place [Flag=1] on the visual object screening and then the result is as follows.

Best Regards,

Neeko Tang

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

5 REPLIES 5
Community Support

Hi @alepagg ,

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a measure.

``````Flag =
var _table=CALCULATETABLE(VALUES('Table'[CUSTOMER]),'Table'[VALUE]<=0)
RETURN IF( not MAX('Table'[CUSTOMER]) in _table,1,0)``````

(3) Place [Flag=1] on the visual object screening and then the result is as follows.

Best Regards,

Neeko Tang

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

Frequent Visitor

Hi Neeko,

However, my real scenario is quite complex and it's hard to replicate your proposal to my dashboard. Maybe you know how to use the Flag to calculate a measure
- the number of Customers active in multiple Brands
- the total value generated by the above Customers

Thank you,

Alessandro

Community Support

Hi @alepagg ,

You can use the COUNTROWS() function to count the number of Customers active in multiple Brands.

You can use the SUMX() function to calculate the total value generated by the above Customers.

For more details, refer: COUNTROWS function (DAX) - DAX | Microsoft Learn

SUMX function (DAX) - DAX | Microsoft Learn

Best Regards,

Neeko Tang

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

Super User

Hi,

Here is one way to do this:

Create the following measure:

Filter for above 0 = IF(MAX('Table (24)'[Value])>0,1,0)

Place is as a filter like this:

Now the slicer works as you described:

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

Proud to be a Super User!

Frequent Visitor

Hi Valtteri,

thanks for your prompt reply but I think it doesn't fully cover my need.

Back to my example, when the user selects both A & B brands, the only customer that shows positive value for both brands is X. Therefore, the outcome measure or table should be only:
X | 3
While customer Y should be excluded since it is positive for brand A but not positive for brand B.

Announcements

#### New forum boards available in Real-Time Intelligence.

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

#### Fabric Monthly Update - May 2024

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

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors