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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
alku0530
Regular Visitor

How to create an interactive table in report which counts rows of another table by group and filter

Dear all,

 

I am new to power bi(<1 week), but have tried any possible solution in the past few days with no progress. Really need your help.

 

I am tasked to create an interactive report using power bi, which contain two data sets. Table 1 has id and percentile, table 2 contains id and risky object with risk levels (and the risk events are recorded as id2). The goal is to create a slicer for percentile and a parameter for costs to solve risk object, and with the slicer and parameter chosen, an interactive table will show the number of risky objects by risk level and automatically calculate corresponding total costs.

The example data is here:

table 1
id       percentile

AAA93
BBB87
CCC84
DDD80
EEE75
FFF60
GGG58
HHH40
III32
JJJ17

 table 2


id      risk level     id2

AAAHigh1
AAALow2
BBBHigh3
BBBMedium4
BBBMedium5
BBBMedium6
CCCLow7
CCCLow8
DDDHigh9
DDDLow10

 

So far I am able to create a count by type table using the following dax code:

Spoiler
count by type = SUMMARIZECOLUMNS('Table (2)'[risk level], "risks", COUNTROWS('Table (2)'))

And the current result is as attached:

alku0530_3-1699725807941.png

 

Ideally as the user move the slicer, the responding count of risks events by type should change accordingly. Although the slicer interact with the table2, it is unable to refresh the risks in 'count by type' table. I know I should replace the column to a measure, or somwhow link the 'count by type' table to the slicer, but just cannot figure how to do them.

 

Any help is appreciated!

 

3 REPLIES 3
alku0530
Regular Visitor

Hi @gmsamborn 

 

Thank you for your reply and advice. However, it must due to my lack of experience. I still don't see how you could create a interactive summary table for table(2). Would you mind to explain more?

Hi @gmsamborn 

 

Eventually I kind of change my route and get my result. Thank you anyway. I will also explain my solution later when have time.

gmsamborn
Super User
Super User

Hi @alku0530 

 

I took a look at your model and made a couple of small changes.

 

Usually I would leave a parameter table like Percentile as a disconnected table.  If your Percentile column in 'Table (1)' is always a whole number between 0 and 100, you can create a one-to-many relationship between 'Percentile'[Percentile] and 'Table (1)'[Percentile] and filtering will handle everything else.

 

(With a disconnected table, you would need one or more [Include] measures to filter table visuals.  Filtering 'Table (1)' is no problem but 'Table (2)' is tougher.)

 

Let me know if you have any questions.

 

Interactive tables - 2.pbix

 

 

Also, I'm not sure what your Cost slicer is for.

Helpful resources

Announcements
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.