Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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
Solved! Go to Solution.
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.
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.
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.
Hi,
Here is one way to do this:
Create the following measure:
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!
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.
User | Count |
---|---|
53 | |
28 | |
19 | |
18 | |
14 |
User | Count |
---|---|
92 | |
86 | |
39 | |
23 | |
22 |