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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
ArchStanton
Impactful Individual
Impactful Individual

Count Measure

Hi,

 

I have a basic measure that counts the number of PrimaryTopics there are in the database:

Primary Topic Count = 
DISTINCTCOUNT('Cases'[PrimaryTopic2])

 

I would like to count the numbers of Primary and Secondary Topics seperately when one or the other is in scope but I'm not sure how to do it?

ArchStanton_0-1758545797086.png

There shouldn't be any 1's in the Primary Topic column unless its a Primary Topic.

 

Can anyone help?

Thanks,

1 ACCEPTED SOLUTION
SamWiseOwl
Super User
Super User

Hi @ArchStanton 

 

I am assuming the bold rows are the primary topics:

Create a new measure:
Count Secondary = 
IF(
    isinscope('Cases'[SecondaryTopic]) --Returns true for Admin but false for Auto enrolement

    ,DISTINCTCOUNT('Cases'[SecondaryTopic])

)

 

For the primary its a little harder as IsInscope would return TRUE on the row of Auto and Admin since Admin is nested into Auto.

Count Secondary = 
IF(
    Not(isinscope('Cases'[SecondaryTopic])) && isinscope('Cases'[PrimaryTopic2])  

--Must return FALSE on Admin  AND return TRUE on Auto (excludes row and grand total)

    ,DISTINCTCOUNT('Cases'[PrimaryTopic2])

)


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

View solution in original post

3 REPLIES 3
v-sdhruv
Community Support
Community Support

Hi @ArchStanton ,

I hope the information provided above assists you in resolving the issue. If you have any additional questions or concerns, please let us know so that we can assist you better.

Thank You @SamWiseOwl  for your prompt response to the query.

SamWiseOwl
Super User
Super User

Hi @ArchStanton 

 

I am assuming the bold rows are the primary topics:

Create a new measure:
Count Secondary = 
IF(
    isinscope('Cases'[SecondaryTopic]) --Returns true for Admin but false for Auto enrolement

    ,DISTINCTCOUNT('Cases'[SecondaryTopic])

)

 

For the primary its a little harder as IsInscope would return TRUE on the row of Auto and Admin since Admin is nested into Auto.

Count Secondary = 
IF(
    Not(isinscope('Cases'[SecondaryTopic])) && isinscope('Cases'[PrimaryTopic2])  

--Must return FALSE on Admin  AND return TRUE on Auto (excludes row and grand total)

    ,DISTINCTCOUNT('Cases'[PrimaryTopic2])

)


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

Thank you for this, much appreciated!

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.