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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
DeckTeck365
Regular Visitor

Trying to return average of true or false based on higher number of each

Hi,

 

In PowerBI I'm trying to create a report that returns the average of true or false based on higher number of each. Basically it's IT based for whether the Anti Virus definition status is up to date on various machines.

 

I'm filtering for the last 7 dates and that returns a table with up to 7 rows per machine. I would like to create a measure for example that would assess whether the count of "true" or "false" for the definitions being up to date is higher per machine and return just that value or "true" if they are equal in number.

 

For example. Today being the 12th Dec 2018 there will be a row per different machine with either true or false each day. If AV updates 4 days out of 7 then I want it to return values of true in just one row.

 

Visaully I mean something like the below with table 1 having al lthe data and the 2nd one being the output report.

 

E.g.

 

CustomerNameDeviceNameDateDefinitionsUpToDate
ACMEACME106/12/2018TRUE
ACMEACME107/12/2018TRUE
ACMEACME108/12/2018TRUE
ACMEACME109/12/2018TRUE
ACMEACME110/12/2018TRUE
ACMEACME111/12/2018FALSE
ACMEACME112/12/2018TRUE
ACMEACME206/12/2018TRUE
ACMEACME207/12/2018TRUE
ACMEACME208/12/2018FALSE
ACMEACME209/12/2018FALSE
ACMEACME210/12/2018FALSE
ACMEACME211/12/2018FALSE
ACMEACME212/12/2018TRUE
ACMEACME306/12/2018TRUE
ACMEACME307/12/2018TRUE
ACMEACME308/12/2018TRUE
ACMEACME309/12/2018FALSE
ACMEACME310/12/2018FALSE
ACMEACME311/12/2018TRUE
ACMEACME312/12/2018TRUE
    
    
CustomerNameDeviceNameDateDefinitionsUpToDate
ACMEACME112/12/2018TRUE
ACMEACME212/12/2018FALSE
ACMEACME312/12/2018TRUE

 


I know that the date column may also be an issue as what date does it put in the column after the measure is applied if it's an aggregate?

 

Many Thanks,

 

Declan

4 REPLIES 4
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @DeckTeck365,

 

You could create a calculated table with formula below to achieve your desired output.

 

Table 2 =
SUMMARIZE (
    'Data',
    'Data'[CustomerName],
    'Data'[DeviceName],
    "maxdate", CALCULATE (
        MAX ( 'Data'[Date] ),
        ALLEXCEPT ( Data, Data[CustomerName], 'Data'[DeviceName] )
    ),
    "DefinitionsUpToDate", IF (
        CALCULATE (
            COUNTROWS ( FILTER ( 'Data', 'Data'[DefinitionsUpToDate] = TRUE () ) ),
            ALLEXCEPT ( Data, 'Data'[CustomerName], Data[DeviceName] )
        )
            > 4,
        TRUE (),
        FALSE ()
    )
)

Here is the output.

 

Capture.PNG

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Cherry,

 

Thanks so much for that , I really appreciate it. 

 

I am running it in DirectQuery mode from a SQL server and it looks like you can't create a Calculated Table that way. 

 

Might need to be a query I run on the SQL server and then DirectQuery the output?

 

Thanks 

 

Declan

 

 

Actually just noticed that part of the feature update for November 2018's version of PowerBI desktop is " Composite models, which allow you to combine direct query and import sources together in one model, is now generally available." So I'll try that! Smiley Happy

 

https://powerbi.microsoft.com/en-us/blog/power-bi-desktop-november-2018-feature-summary/

 

Thanks 

 

Declan

Hi @DeckTeck365,

 

Have you solved your problem?

 

If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

If you still need help, please feel free to ask.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors