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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Daniel_Derbin
Frequent Visitor

Allexcept measure issue

Hi, 

The goal is to conditionally format a measure (background color) depending on selected filters.
Constrains, all data dim and fact are in one table.

In order to get to my final measure i had to create some nesting first:

1. Number of Vuln day = SUM('Fact daily'[count])
2. Vuln wo sev =
CALCULATE([Number of Vuln day],
    ALLEXCEPT('Fact daily', 'Fact daily'[Severity])
)
That allowed me to create a Divide measure - crucial for result as each of severities should add up to 100% in column total.
% of Vuln =
CALCULATE(
    DIVIDE([Number of Vuln day],[Vuln wo sev])
)
Daniel_Derbin_0-1688555098235.png

 

With conditional formatting of % of Vuln  

Daniel_Derbin_2-1688555362518.png

Now my problem starts when i try to filter report by department (also as a part of same table)
I seek for a measure that upon selection will calculate results to 100% for all severities, not only filtered part of data:

Daniel_Derbin_3-1688555572916.png


I can achieve this result by using Number of Vuln day measure and showing calculation by "Percent of column total", but then logic used to conditionally format fields won't apply.

Daniel_Derbin_4-1688555760884.png

Does anyone have an idea how to resolve this?

Lastly, measure for conditional formatting:

format risk = SWITCH (
    TRUE (),
     [% of Vuln] = BLANK(),"#fe9180",
    SELECTEDVALUE ( 'Fact daily'[Age categories] ) = "0-30 days"
        && SELECTEDVALUE ( 'Fact daily'[Severity] ) = "Critical"
        && [% of Vuln] >= 0.85, "#33ac7f",
    SELECTEDVALUE ( 'Fact daily'[Age categories] ) = "31-60 days"
        && SELECTEDVALUE ( 'Fact daily'[Severity] ) = "Critical"
        && [% of Vuln] <= 0.15
        && [% of Vuln] > 0, "#f7dd7e",
    (
        SELECTEDVALUE ( 'Fact daily'[Age categories] ) = "0-30 days"
            || SELECTEDVALUE ( 'Fact daily'[Age categories] ) = "31-60 days"
    )
        && SELECTEDVALUE ( 'Fact daily'[Severity] ) = "High"
        && [% of Vuln] >= 0.95, "#33ac7f",
    SELECTEDVALUE ( 'Fact daily'[Age categories] ) = "61-90 days"
        && SELECTEDVALUE ( 'Fact daily'[Severity] ) = "High"
        && [% of Vuln] <= 0.1
        && [% of Vuln] > 0, "#f7dd7e",
    (
        SELECTEDVALUE ( 'Fact daily'[Age categories] ) = "0-30 days"
            || SELECTEDVALUE ( 'Fact daily'[Age categories] ) = "31-60 days"
            || SELECTEDVALUE ( 'Fact daily'[Age categories] ) = "61-90 days"
            || SELECTEDVALUE ( 'Fact daily'[Age categories] ) = "91-120 days"
    )
        && SELECTEDVALUE ( 'Fact daily'[Severity] ) = "Medium"
        && [% of Vuln] >= 0.98, "#33ac7f",
    SELECTEDVALUE ( 'Fact daily'[Age categories] ) = "121-180 days"
        && SELECTEDVALUE ( 'Fact daily'[Severity] ) = "Medium"
        && [% of Vuln] <= 0.1
        && [% of Vuln] > 0, "#f7dd7e",
    (
        SELECTEDVALUE ( 'Fact daily'[Age categories] ) = "0-30 days"
            || SELECTEDVALUE ( 'Fact daily'[Age categories] ) = "31-60 days"
            || SELECTEDVALUE ( 'Fact daily'[Age categories] ) = "61-90 days"
            || SELECTEDVALUE ( 'Fact daily'[Age categories] ) = "91-120 days"
            || SELECTEDVALUE ( 'Fact daily'[Age categories] ) = "121-180 days"
    )
        && SELECTEDVALUE ( 'Fact daily'[Severity] ) = "Low"
        && [% of Vuln] >= 0.98, "#33ac7f",
    SELECTEDVALUE ( 'Fact daily'[Age categories] ) = "180-360 days"
        && SELECTEDVALUE ( 'Fact daily'[Severity] ) = "Low"
        && [% of Vuln] <= 0.1
        && [% of Vuln] > 0, "#f7dd7e",
       

    "#fe9180"
)


 



 



1 REPLY 1
lbendlin
Super User
Super User

and showing calculation by "Percent of column total", but then logic used to conditionally format fields won't apply

Correct. you will need to implement that logic inside your measure.

 

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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