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
reidnmorrison
Resolver II
Resolver II

DAX measure or Summarized table

Hello, 


I have data in the below format. I want to create a measure that will calculate the number of staff that have a rating that has only been completed by the manager. For example in the below it would total 2 as Person A has one (rating a) and Person C also has 1 (rating b).

 

If this is not possbible using measures, am I missing anything else before creating a new summarized table 

 

reidnmorrison_0-1716294533144.png

 

2 ACCEPTED SOLUTIONS

Got you. A bit funky but here you go:

ray_aramburo_0-1716308077591.png

I created a concatenated column that would give me a Person + Rating so I could count that key. After that I created this measure that would give me the total occurrences of this key (I want everything that's just 1):

CountAllS = CALCULATE(COUNT('Table'[PersonRating]), ALLEXCEPT('Table', 'Table'[PersonRating]))

After this, I created a measure that counts the number of times this measure is just 1 and only for those that were rated by the manager:

Unique Count = CALCULATE(COUNTROWS(FILTER(KEEPFILTERS(SUMMARIZECOLUMNS('Table'[PersonRating], "Count", [CountAllS])), [Count] < 2)), 'Table'[Rated by] = "Manager")

Find attached my working file so you can take a dive on it 🙂 





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





View solution in original post

v-huijiey-msft
Community Support
Community Support

Hi @reidnmorrison ,

 

Your solution is great, @ray_aramburo . It worked like a charm! Here I have another idea in mind, and I would like to share it for reference.

 

Just create a measure, the syntax is as follows:

Count = CALCULATE(
     DISTINCTCOUNT('Table'[Person]),
     FILTER(
         'Table',
         'Table'[Rated by] = "Manager" &&
         CALCULATE(
             COUNTROWS('Table'),
             'Table'[Rated by] = "Self"
         ) = 0
     )
)

 

Drag measure to the report page for display:

vhuijieymsft_0-1716342823693.png

 

pbix file is attached.

 

If you have any further questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

4 REPLIES 4
v-huijiey-msft
Community Support
Community Support

Hi @reidnmorrison ,

 

Your solution is great, @ray_aramburo . It worked like a charm! Here I have another idea in mind, and I would like to share it for reference.

 

Just create a measure, the syntax is as follows:

Count = CALCULATE(
     DISTINCTCOUNT('Table'[Person]),
     FILTER(
         'Table',
         'Table'[Rated by] = "Manager" &&
         CALCULATE(
             COUNTROWS('Table'),
             'Table'[Rated by] = "Self"
         ) = 0
     )
)

 

Drag measure to the report page for display:

vhuijieymsft_0-1716342823693.png

 

pbix file is attached.

 

If you have any further questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

ray_aramburo
Super User
Super User

Why is Person C, rating a not included in your count?

Anyways the measure can be done in 2 ways (depending to the answer of my first question) :

Person Count = CALCULATE(COUNTROWS("TableName"), Rated by = "Manager")

If you need to explicitly indicate "a" rating then just modify it this way:

Person Count = CALCULATE(COUNTROWS("TableName"), Rated by = "Manager", Rating = "a")

If you need to address unique person then just use DISTINCTCOUNT([Person]) instead of COUNTROWS.





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





Hi, thank you for yor reply. Person C rating a is not included as they have [Rated by] entry for both "Manager" and "Self". I just need those that only have a [Rated by] "Manager". Hence I'm not sure the simple COUNT or DISTINCTCOUNT will work.

Got you. A bit funky but here you go:

ray_aramburo_0-1716308077591.png

I created a concatenated column that would give me a Person + Rating so I could count that key. After that I created this measure that would give me the total occurrences of this key (I want everything that's just 1):

CountAllS = CALCULATE(COUNT('Table'[PersonRating]), ALLEXCEPT('Table', 'Table'[PersonRating]))

After this, I created a measure that counts the number of times this measure is just 1 and only for those that were rated by the manager:

Unique Count = CALCULATE(COUNTROWS(FILTER(KEEPFILTERS(SUMMARIZECOLUMNS('Table'[PersonRating], "Count", [CountAllS])), [Count] < 2)), 'Table'[Rated by] = "Manager")

Find attached my working file so you can take a dive on it 🙂 





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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