cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
EaglesFly123
New Member

Issue Calculating Count when using Measure to Filter Data

I am having issue crafting a measure to display the total number of records based on a measure displayed in a Table.  I would have thought this was easy, especially after seeing This Thread.  However, my calculation is not coming out with the correct value.

Below is the data being displayed based on selected filters and relationships.  It is properly displaying the expected ID's and it has the proper results for the Fix Attempts Measure.  I am trying to get the total number of records that had Fix Attempts = 1.  As you can see my calculation is not giving the correct result.  If I set a visual Level filter for Fix Attempts =1, the rows that should make up the calculation are properly displayed.

Here is my measure 

 

With 1 Fix = 
CALCULATE(
    DISTINCTCOUNT(Bugs[WorkItemId]),
    FILTER(Bugs,Bugs[Fix Attempts]=1))

 

 Here is the measure total, for the below data, which is off.

Measure Result.png

Data Table (all coming from table - Bugs)

Displayed Data.png

Data filtered with Visual level filter, that shows my measure result should be 9, for the data displayed

Data with Visual Level Filter.png

1 ACCEPTED SOLUTION

Hi,

Try this measure

With 1 Fix = CALCULATE(DISTINCTCOUNT(Bugs[WorkItemId]),FILTER(values(bugs[id]),[Fix Attempts]=1))

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
selimovd
Community Champion
Community Champion

Hey @EaglesFly123 ,

 

try the following measure:

With 1 Fix =
CALCULATE(
    DISTINCTCOUNT( Bugs[WorkItemId] ),
    Bugs[Fix Attempts] = 1
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

HI @selimovd 

 

When I do that, I get an error - A function 'CALCULATE' has been involved in a True/False expression that is used as a filter expression.  This is not allowed.

Hey @EaglesFly123 ,

 

what is Bugs[Fix Attempts]?

Is that a column or a measure?

 

Best regards

Denis

 

Hi,

Try this measure

With 1 Fix = CALCULATE(DISTINCTCOUNT(Bugs[WorkItemId]),FILTER(values(bugs[id]),[Fix Attempts]=1))

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Top Kudoed Authors