The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
This is the problem:
My tables are linked like this
TABLE_SUPPLIERS_PRODUCT_MANAGER.CodeManager = TABLE_ORDERS.CodeManager
TABLE_SUPPLIERS_PRODUCT_MANAGER
CodeSupplier | CodeProduct | CodeManager (PK) | Have Orders |
A | Tables | Manager 001 | Y |
A | Chairs | Manager 002 | N |
A | Chairs | Manager 003 | Y |
B | Tables | Manager 004 | Y |
B | Tables | Manager 005 | N |
B | Chairs | Manager 006 | Y |
B | Shelves | Manager 007 | N |
C | Shelves | Manager 008 | N |
TABLE_ORDERS
OrderNumber | CodeManager | CodeProduct | Units |
0001 | Manager 001 | Tables | 10 |
0002 | Manager 001 | Tables | 1 |
0003 | Manager 003 | Chairs | 10 |
0004 | Manager 006 | Chairs | 20 |
0005 | Manager 004 | Tables | 20 |
So, I have the following measure:
No. Registered suppliers = DISTINCTCOUNT(TABLE_SUPPLIERS_PRODUCT_MANAGER[CodeSupplier])
No. Registered suppliers with orders=
CALCULATE([No. Registered suppliers], FILTER(TABLE_SUPPLIERS_PRODUCT_MANAGER, TABLE_SUPPLIERS_PRODUCT_MANAGER[HaveOrders]="Y"))
And now I want:
This measure not works
No. Registered suppliers without orders= CALCULATE([No. Registered suppliers], FILTER(TABLE_SUPPLIERS_PRODUCT_MANAGER, TABLE_SUPPLIERS_PRODUCT_MANAGER[HaveOrders]="N"))
Because this includes suppliers who, perhaps with another product have orders.
With the data I have provided, this value should give
If the user filters to see only SHELVES products, the measurements would be
If the user filters to see only CHAIRS products, the measurements would be
Solved! Go to Solution.
Hi, @Manudata
You can try the following methods.
Column:
Column YN = CALCULATE(MAX(TABLE_SUPPLIERS_PRODUCT_MANAGER[Have Orders]),ALLEXCEPT(TABLE_SUPPLIERS_PRODUCT_MANAGER,TABLE_SUPPLIERS_PRODUCT_MANAGER[CodeSupplier]))
Measure Y = CALCULATE(DISTINCTCOUNT(TABLE_SUPPLIERS_PRODUCT_MANAGER[CodeSupplier]),FILTER(ALL(TABLE_SUPPLIERS_PRODUCT_MANAGER),[CodeProduct]=MAX(TABLE_SUPPLIERS_PRODUCT_MANAGER[CodeProduct])&&[Have Orders]="Y"))+0
Measure N =
Var _N1=CALCULATE(DISTINCTCOUNT(TABLE_SUPPLIERS_PRODUCT_MANAGER[CodeSupplier]),FILTER(ALL(TABLE_SUPPLIERS_PRODUCT_MANAGER),[CodeProduct]=MAX(TABLE_SUPPLIERS_PRODUCT_MANAGER[CodeProduct])&&[Have Orders]="N"))+0
Var _N2=CALCULATE(DISTINCTCOUNT(TABLE_SUPPLIERS_PRODUCT_MANAGER[CodeSupplier]),FILTER(ALL(TABLE_SUPPLIERS_PRODUCT_MANAGER),[CodeProduct]=MAX(TABLE_SUPPLIERS_PRODUCT_MANAGER[CodeProduct])&&[Column YN]="N"))+0
Return
IF(SELECTEDVALUE(TABLE_SUPPLIERS_PRODUCT_MANAGER[CodeProduct])=BLANK(),_N1,_N2)
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Manudata
You can try the following methods.
Column:
Column YN = CALCULATE(MAX(TABLE_SUPPLIERS_PRODUCT_MANAGER[Have Orders]),ALLEXCEPT(TABLE_SUPPLIERS_PRODUCT_MANAGER,TABLE_SUPPLIERS_PRODUCT_MANAGER[CodeSupplier]))
Measure Y = CALCULATE(DISTINCTCOUNT(TABLE_SUPPLIERS_PRODUCT_MANAGER[CodeSupplier]),FILTER(ALL(TABLE_SUPPLIERS_PRODUCT_MANAGER),[CodeProduct]=MAX(TABLE_SUPPLIERS_PRODUCT_MANAGER[CodeProduct])&&[Have Orders]="Y"))+0
Measure N =
Var _N1=CALCULATE(DISTINCTCOUNT(TABLE_SUPPLIERS_PRODUCT_MANAGER[CodeSupplier]),FILTER(ALL(TABLE_SUPPLIERS_PRODUCT_MANAGER),[CodeProduct]=MAX(TABLE_SUPPLIERS_PRODUCT_MANAGER[CodeProduct])&&[Have Orders]="N"))+0
Var _N2=CALCULATE(DISTINCTCOUNT(TABLE_SUPPLIERS_PRODUCT_MANAGER[CodeSupplier]),FILTER(ALL(TABLE_SUPPLIERS_PRODUCT_MANAGER),[CodeProduct]=MAX(TABLE_SUPPLIERS_PRODUCT_MANAGER[CodeProduct])&&[Column YN]="N"))+0
Return
IF(SELECTEDVALUE(TABLE_SUPPLIERS_PRODUCT_MANAGER[CodeProduct])=BLANK(),_N1,_N2)
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Create this measure
Thanks for the clear description of the problem with example data. I wish everyone did that!
Remember we are unpaid volunteers. So please click the thumbs up and the [accept as solution] button to leave kudos.
One question per ticket please. If you need to extend your request then please raise a new ticket.
If you quote @speedramos in your next tickets then I will then receive an automatic notification, and will be delighted to help you again.
Please click the thumbs up and the [accept as solution] button now. Thank you.