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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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