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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
jaryszek
Resident Rockstar
Resident Rockstar

How to get answer for question, How many Tags per resource I have?

Hello,

My model is:

jaryszek_0-1763977905038.png


nad now i want to get answer for a question: How many Tags per resource I have?

Tried to use measure:

New_Resources Count = 
DISTINCTCOUNT ( 'Dim_EA_Resource_Bridge_Tags'[DateResourceIdKey] )


But I got a constant...why? 

jaryszek_1-1763977990746.png


EDIT:

I created sample model like here:

jaryszek_0-1763983990276.png



used a measure :

Products per Tag = 
DISTINCTCOUNT( Bridge_ProductTags[ProductKey] )


and eveyrthing worked...oh but why?



Best,
Jacek

 

1 ACCEPTED SOLUTION

Hi @jaryszek,

Thank you  for reaching out to the Microsoft fabric community forum.

The main reason you are getting a constant value is that the filter from the Tag table is not reaching the bridge table in your actual model. Because of this, Power BI is counting all resources every time, instead of only the resources for the selected tag. That’s why your SQL query shows different counts, but the DAX measure gives the same number.

In your sample Product Tag model it works because the relationships allow the filter to flow correctly. But in your real model the filter direction is blocking it.

You can fix this by Turning on bidirectional filter on the relationship used for this calculation or Using a DAX measure that forces the filter to pass through.

After this, the DISTINCTCOUNT will respond correctly for each tag.

Hope the above provided information help you resolve the issue, if you have any further concerns or queries, please feel free to reach out to us.
Regards,
Coummunity support Team.

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@jaryszek , measure should not be created be Dim level. It has created at fact level  

 

New_Resources Count = 
Countrows( Summarize(Fact,  'Dim_EA_Resource_Bridge_Tags'[DateResourceIdKey] ) )

. Make sure you have bi-direction join between the resource and Amortized Cost 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

And futhermore,

I am trying to use best practices design from this topic:

https://community.fabric.microsoft.com/t5/Desktop/How-to-get-costs-for-Specific-Group-within-Bridge-...

to not use bidrectional relationships everywhere.

Best,
Jacek

Hi @jaryszek,

Thank you  for reaching out to the Microsoft fabric community forum.

The main reason you are getting a constant value is that the filter from the Tag table is not reaching the bridge table in your actual model. Because of this, Power BI is counting all resources every time, instead of only the resources for the selected tag. That’s why your SQL query shows different counts, but the DAX measure gives the same number.

In your sample Product Tag model it works because the relationships allow the filter to flow correctly. But in your real model the filter direction is blocking it.

You can fix this by Turning on bidirectional filter on the relationship used for this calculation or Using a DAX measure that forces the filter to pass through.

After this, the DISTINCTCOUNT will respond correctly for each tag.

Hope the above provided information help you resolve the issue, if you have any further concerns or queries, please feel free to reach out to us.
Regards,
Coummunity support Team.

 

Thanks,

measure should not be created be Dim level.

Why ?



I did this like that:

 



New_Resources Count 3 =
Countrows( Summarize(Fct_EA_AmortizedCosts, 'Dim_EA_AmortizedCosts_Resources'[DateResourceIdKey]) )


and still has constant:


And secondly, I tried with dbeaver anf t-sql on fanric with this query:

SELECT
tk.[Key],
tk.[Value],
COUNT(DISTINCT bt.DateResourceIdKey) AS ResourceCount
FROM Mart7.Dim_EA_Resource_TagKeys AS tk
JOIN Mart7.Dim_EA_Resource_Bridge_Tags AS bt
ON tk.DateKeyKey = bt.DateKeyKey
WHERE tk.[Key] = '__AzureDevOpsElasticPool'
GROUP BY
tk.[Key],
tk.[Value]
ORDER BY
COUNT(DISTINCT bt.DateResourceIdKey),
tk.[Key],
tk.[Value];

an it worked, showing different numbers not a constant ones. 
Why?

Best,
Jacek

 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.