Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi,
Sorry for the basic question here:
I have 2 tables, a pricing table and a material table (joined by material ID). I want to understand where i have a record in my material table but do not have a price for it. I basically want to count the non matching rows in the pricing table when i plot my material table:
EG:
Material Table
| Material | Product |
| 123 | 1 |
| 345 | 1 |
| 678 | 1 |
Pricing Table:
| Material | Price |
| 123 | £100 |
| XXX | £50 |
I want a measure to return a count of '2' when i select Product '1'
Solved! Go to Solution.
Create a one-to-many single direciton relationship from Price to Material
Create this measure:
count =
CALCULATE (
COUNTROWS ( Material ),
KEEPFILTERS ( ISBLANK ( 'Price'[Material] ) )
)
Create a one-to-many single direciton relationship from Price to Material
Create this measure:
count =
CALCULATE (
COUNTROWS ( Material ),
KEEPFILTERS ( ISBLANK ( 'Price'[Material] ) )
)
I want to add a layer of complexity to this... So my price table can have multiple rows in it (for differing prices & dates)
I want to essentially do the same (count the blank rows) however, due to the natrue of this structure it now returns '3'
new Price Table:
| Material | Price | Date |
| 123 | £100 | 01/01/2024 |
| XXX | £10 | 01/01/2024 |
| 123 | £50 | 02/01/2024 |
Break the relationship between the two tables and try this:
non matching materials =
COUNTROWS (
-- EXCEPT returns the set of values in 'Material[Material]' that are not in 'Price[Material]'
EXCEPT ( VALUES ( Material[Material] ), VALUES ( 'Price'[Material] ) )
)
This seems to work, however i am always going to have a relationship with the 2 tables
Create a relationship between the Material Table and the Pricing Table using the Material column.
Create a measure in your Material Table to count the non-matching rows
DAX
NonMatchingCount =
CALCULATE(
COUNTROWS('Material Table'),
ISBLANK(RELATED('Pricing Table'[Price]))
)
Proud to be a Super User! |
|
this syntax is incorrect..
Please share more information, I am not clear what you are expecting in result.
i want a single card visual displaying the number of materials which do not have a price. in this case material 345 and 678 do not have prices so i would want the result 2
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 45 | |
| 41 | |
| 20 | |
| 18 |
| User | Count |
|---|---|
| 69 | |
| 64 | |
| 32 | |
| 31 | |
| 27 |