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

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

Reply
alepagg
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
v-tangjie-msft
Community Support
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.

vtangjiemsft_0-1709609460658.png

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. 

View solution in original post

5 REPLIES 5
v-tangjie-msft
Community Support
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.

vtangjiemsft_0-1709609460658.png

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. 

Hi Neeko,

Thanks a lot for your help! Your solution does work!

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

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. 

ValtteriN
Super User
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:
ValtteriN_0-1709467098072.png

 

Now the slicer works as you described:
ValtteriN_1-1709467128103.png

 

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!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Fabric Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors