Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi,
I am needing to show distinct count of billed materials in a field called category3. I have a billed table(containsthe billed distinct materials field) and a material table (contains the material category 3 field that corresponds to an item id). The value is currently showing distinct materials (item id) and not the count of categories.
How would I show the distinct count of categories from items bought?
Here is my card:
Here is my visual build:
Solved! Go to Solution.
Hi @Anonymous,
As you r KPI card show the disticts values, to calculate the distinct count of categories (Category3) from the items bought, you need to ensure you correctly establish the relationship between the Billed table and the Material table, and then use DAX to calculate the distinct count of Category3.
Here’s how you can achieve this:
Ensure there is a relationship between the Billed table and the Material table, likely on a common field such as ItemID.
Create a DAX measure to calculate the distinct count of Category3 for items in the Billed table:
DistinctCategory3Count =
CALCULATE(
DISTINCTCOUNT(Material[Category3]),
TREATAS(VALUES(Billed[ItemID]), Material[ItemID])
)Place the new measure (DistinctCategory3Count) in your table, card, or other visuals. It will display the distinct count of Category3 based on the items billed.
This approach will calculate the distinct count of Category3 for only those items that have been billed. Let me know if you need further clarification!
Hi @Anonymous ,
Please try to use the following measure:
Distinct Count of Categories =
CALCULATE(
DISTINCTCOUNT('Material Table'[category3]),
'Material Table'[Item ID] IN VALUES('Billed Table'[Item ID])
)
Hi,
Thanks for the quick response. This does not work for me. Is there a way I can use the measure "Billed Distinct Item ID" (billed order table) and the field material category3 (material table) to show the distinct material category 3 count for a customer?
Hi @Anonymous ,
Can you please share a sample file?
Hi,
I am not sure how as I am using Analysis Services.
Hi @Anonymous ,
Its not easy to get the soluion if we dont have a sample file to make tests, but based on your descrption lets try this:
1- Make sure there is a relationship between the Billed Order Table and the Material Table via the Item ID field.
2- Update the measure:
DistinctMaterialCategoriesForCustomer =
CALCULATE(
DISTINCTCOUNT(Material[Category3]),
FILTER(
BilledOrder,
NOT(ISBLANK(BilledOrder[ItemID])) &&
RELATED(Material[ItemID]) = BilledOrder[ItemID]
)
)
Happy that you found the solution, please consider to accept it as solution.
Thank you
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 |
|---|---|
| 52 | |
| 38 | |
| 37 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 66 | |
| 63 | |
| 34 | |
| 32 | |
| 21 |