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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
krimyr
Frequent Visitor

How to count multiple dims away?

Hi,

 

I have a Fact table.

This is connected to a DimDate with the Date field, working great..

... and also connected to a lot of other Dim tables, working great..

 

I have connected my Fact to DimTable1 -> DimTable2 -> DimTable3 -> DimTable4.

On DimTable4 I want to count how many there is where Type=1, Type=2 etc..

 

I have a COUNTROWS(DimTable4) in my Fact, and filtering on the type. No matter what I do, it only shows me the total amount of rows.

 

What do I have to change, and why?

 

Thanks in advance.

 

6 REPLIES 6
parry2k
Super User
Super User

@krimyr see below:

 

If I filter on the Fact column that has relationship to DimTable1, it wont affect the result. this will not, since fact table doesn't filter dimension table. There are ways to work with this but with your current relationship it will not.

 

If I filter on the DimTable1 column that has relationship to DimTable2, it wont affect the result. If dim table1 has relationship dim table 2 (1 to many) then it should work. Can you share relationship diagram?

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

krimyr
Frequent Visitor

 

CountDimRows = COUNTROWS(DimTable4)

 

DimTalbe2[Name] as ROWS
DimTable4[Type] as COLUMNS
CountDimRows as VALUES

 

krimyr_0-1698744891915.png

 

Shows as I want it.

 


If I filter on the Fact column that has relationship to DimTable1, it wont affect the result.
If I filter on the DimTable1 column that has relationship to DimTable2, it wont affect the result.
If I filter on the DimTable2 column that has relationship to DimTable3, it does affect the result as it should.

 

Why is that?

It seems that there's relationships missing, but its connected, and I can't see the problem.

krimyr
Frequent Visitor

You are right, now it works. I have been working on this too many hours. I of course must have done something different. Thanks

parry2k
Super User
Super User

@krimyr if you create a measure that countrows from dimtable4 and you visualize using type (from same table), it should give the result you are looking for or maybe I'm missing something.

 

Count = COUNTROWS ( DimTable4 ) 


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@krimyr your presentation seems confusing, I guess dim tables doesn't have a relationship with each other?

 

Which table has the type column?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I am sorry! I thought it was clear.

 

Fact has a relationship to DimTable1. (1 to many)
DimTable1 has a relationship to DimTable2 (1 to many)
DimTable2 has a relationship to DimTable3 (1 to many)

DimTable3 has a relationship to DimTable4 (1 to many)


DimTable4 has Type which I want to count based on Type=1,2,3 etc.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.