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
Anonymous
Not applicable

Create measure % of total complete for a subset of records in a table

Hi,

 

I am trying to create individual cards for each business region and show how many of the servers have been patched

 

HostRegionPatched
A11AMERICASYes
A45AMERICASNo
E55EMEAYes
E34EMEAYes
E44EMEANo
E67EMEAYes

 

Card should show "50% of all AMERICAS hosts patched"

1 ACCEPTED SOLUTION
nandic
Memorable Member
Memorable Member

Hi,

Demo file attached.
This is example of calculated column using dax:

Result:

region success.PNG

 


Counter =
VAR _totalRows =
    CALCULATE (
        COUNTROWS ( RegionTable ),
        FILTER ( RegionTable, RegionTable[Region] = EARLIER ( RegionTable[Region] ) )
    )
VAR _totalPatchedRows =
    CALCULATE (
        COUNTROWS ( RegionTable ),
        FILTER ( RegionTable, RegionTable[Region] = EARLIER ( RegionTable[Region] ) ),
        FILTER ( RegionTable, RegionTable[Patched] = "Yes" )
    )
RETURN
    FORMAT ( DIVIDE ( _totalPatchedRows_totalRows )"0%" ) & " of all " & RegionTable[Region] & " hosts patched"

 

Regards,
Nemanja Andic

 

View solution in original post

2 REPLIES 2
nandic
Memorable Member
Memorable Member

Hi,

Demo file attached.
This is example of calculated column using dax:

Result:

region success.PNG

 


Counter =
VAR _totalRows =
    CALCULATE (
        COUNTROWS ( RegionTable ),
        FILTER ( RegionTable, RegionTable[Region] = EARLIER ( RegionTable[Region] ) )
    )
VAR _totalPatchedRows =
    CALCULATE (
        COUNTROWS ( RegionTable ),
        FILTER ( RegionTable, RegionTable[Region] = EARLIER ( RegionTable[Region] ) ),
        FILTER ( RegionTable, RegionTable[Patched] = "Yes" )
    )
RETURN
    FORMAT ( DIVIDE ( _totalPatchedRows_totalRows )"0%" ) & " of all " & RegionTable[Region] & " hosts patched"

 

Regards,
Nemanja Andic

 

Anonymous
Not applicable

Thank you Nemanja! This is exactly what I was looking for!

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.