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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Arete
Helper I
Helper I

Measure to calculate set over specified percentage

I have a measure that calculates the percent difference between 2 measures and I want to be able to return all the records that are above 0%

 

Data: 

RecordValueType
1John DoeName
1123 Main streetAddress
2Jane DoeName
2John DoeName

 

 

Total Records= 
CALCULATE(
    DISTINCTCOUNT('tbl'[Record])
)    

 

 

 

Total Entities = 
CALCULATE(
    COUNT('tbl'[Value])
)
Total Unique Entities = 
CALCULATE(
    DISTINCTCOUNT('tbl'[Value])
)
Unique Entity % diff = 
DIVIDE([Total Entities] - [Total Unique Entities], [Total Entities])

 

 

I want to now have a card show how many records are over 0% but all the measures I create aren't working.

 

Thanks for the help!

1 ACCEPTED SOLUTION
Shaurya
Memorable Member
Memorable Member

Hi @Arete,

 

You want this difference to be calculated for all records but you are it in a measure which does not support row context. Try this instead:

 

New Table = SUMMARIZE('Test Table','Test Table'[Record],"Count",COUNT('Test Table'[Value]),"Disctinct Count",DISTINCTCOUNT('Test Table'[Value]))

 

A new table will be created with count and disctinct count for every record. Add another column in for difference.

 

Difference = 'New Table'[Count]-'New Table'[Disctinct Count]

 

Now use this difference column to get the count.

 

Diff_More_Than_Zero = CALCULATE(COUNT('New Table'[Record]),FILTER('New Table','New Table'[Difference]>0))

 

You can add more columns based on your need of percentage.

 

Works for you? Mark this post as a solution if it does!
Check out this blog of mine: How to Export Telemetry Data from Azure IoT Central into Power BI

View solution in original post

4 REPLIES 4
Shaurya
Memorable Member
Memorable Member

Hi @Arete,

 

I used all your measures and it works fine.

 

Screenshot 2022-12-20 220753.jpg

 

Can you share a screenshot of the issue that you are facing?

Hi @Shaurya!

 

I'm trying to create a new measure that returns the number of records that are greater than 0 in the Unique Entity % diff measure:

 

Arete_0-1671563651170.png

In my data set there can be duplicate values with a different type:

 

RecordValueType
1John DoePerson
1123 Main StreetAddress
1111-11-1111Social Security Number
1111-11-1111Passport Number

 

In this example, the Total Entities is 4 and the Total Unique Entities is 3 and the % diff is higher than 0% so it should be counted.

Shaurya
Memorable Member
Memorable Member

Hi @Arete,

 

You want this difference to be calculated for all records but you are it in a measure which does not support row context. Try this instead:

 

New Table = SUMMARIZE('Test Table','Test Table'[Record],"Count",COUNT('Test Table'[Value]),"Disctinct Count",DISTINCTCOUNT('Test Table'[Value]))

 

A new table will be created with count and disctinct count for every record. Add another column in for difference.

 

Difference = 'New Table'[Count]-'New Table'[Disctinct Count]

 

Now use this difference column to get the count.

 

Diff_More_Than_Zero = CALCULATE(COUNT('New Table'[Record]),FILTER('New Table','New Table'[Difference]>0))

 

You can add more columns based on your need of percentage.

 

Works for you? Mark this post as a solution if it does!
Check out this blog of mine: How to Export Telemetry Data from Azure IoT Central into Power BI

This is so helpful on so many levels. Thanks for adding the clarification and the quick response. Bravo!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.