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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
tomperro
Helper V
Helper V

How do you show a count by category when the category is not in the visual.

How do you show a count by category when the category is not in the visual.

I have two related tables, Category and Tests. 
I have a measure that counts how many tests per category, this works when the category is in the table visual, however, when I remove the category from the visual, obviosly the count by categories does not work. 

Is there a way to create a measure that will count the number of tests and group by category without the category in the visual?
I have another table visual that shows the categories and a score, which is an aggregated score of multiple test numbers and I need a seperate table that shows the test number and that individual aggregated score for that test number for each category. 

 

Aggregated Score (measure) is a combination of other counts.

 

Example
 

CategoryAggregated Score (measure)
A123
B345
C456

 

 

TestCategory
1A
2A
3B
4B
5C
6C

 

Current Visual

CategoryScore (sum of all test scores)
A8
B2
C4

 

Required Visual

TestAggregated Score (measure)
Test 15
Test 23
Test 31
2 ACCEPTED SOLUTIONS
wardy912
Super User
Super User

Hi @tomperro 

 

 Assuming your tables are split as you've shown, and are related, try this

 

Aggregated Score per Test = 
CALCULATE(
    [Aggregated Score],
    FILTER(
        ALL('Category'),
        'Category'[Category] = RELATED('Tests'[Category])
    )
)

 

I hope this helps, please give a thumbs up and mark as solved if it does, thanks!

View solution in original post

Changed the measure:

Test Composite Score =
    VAR CurrentCategory = SELECTEDVALUE(Tests[Test Category])
   
    RETURN

    CALCULATE(
        [Composite Score],
        Filter(
            ALL(Category),
            Category[Category] = CurrentCategory
        )
    )

View solution in original post

6 REPLIES 6
wardy912
Super User
Super User

Try this:

 

Aggregated Score per Test =
CALCULATE(
    [Aggregated Score],
    FILTER(
        ALL('Category'),
        'Category'[Category] = LOOKUPVALUE('Tests'[Category], 'Tests'[Test], SELECTEDVALUE('Tests'[Test]))
    )
)
wardy912
Super User
Super User

Hi @tomperro 

 

 Assuming your tables are split as you've shown, and are related, try this

 

Aggregated Score per Test = 
CALCULATE(
    [Aggregated Score],
    FILTER(
        ALL('Category'),
        'Category'[Category] = RELATED('Tests'[Category])
    )
)

 

I hope this helps, please give a thumbs up and mark as solved if it does, thanks!

@wardy912 , this looks like a solution but I am getting an error: cannot find name 'Tests'[Category]

Hi @tomperro 

 

 You need to use the measure as a template, add your table/column names.

Changed the measure:

Test Composite Score =
    VAR CurrentCategory = SELECTEDVALUE(Tests[Test Category])
   
    RETURN

    CALCULATE(
        [Composite Score],
        Filter(
            ALL(Category),
            Category[Category] = CurrentCategory
        )
    )

@wardy912 I have done that and that is where i am getting the error

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.