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
Chan
Regular Visitor

Calculated column using value from Measure

Hi

Team,

 

Need your help!

 

I have a Matrix report on Power BI , where I need to add a column which compares the total of the row against the value of dynamic measure and derived the outcome.

 

For Example, Total Score of each of the employee needs to match against the required score (which is a dynamic measure based on the slicer value) and calculate whether each employee has full access or partial access.

 

Current Output.

Capture.JPG

 

Desired Output:

 

Capture.JPG

 

Thanks for your help in advance!!

 

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Chan ,

 

Not really sure how you have your data setup but I'm assuming is simlar to this:

Employee  Name Attribute Value

1 A V1 2
1 A V2 2
1 A V3 2
1 A V4 2
2 B V1 2
2 B V2 2
2 B V3 1
3 C V1 1
3 C V2 2

 

If this is the case then you need to add a measure that looks like this:

Conditional column =
IF (
    CALCULATE ( SUM ( Table1[Value] ); ALLEXCEPT ( Table1; Table1[Employee] ) ) >= 'Required Score'[Required Score Value];
    "Full";
    "Part"
)

 

If your table has one column per each V you should do somehting like this:

Conditional column =
IF (
    CALCULATE (
        SUM ( Table1[V1] ) + SUM ( Table1[V2] )
            + SUM ( Table1[V3] )
            + SUM ( Table1[V4] );
        ALLEXCEPT ( Table1; Table1[Employee] )
    ) >= 'Required Score'[Required Score Value];
    "Full";
    "Part"
)

 

Be aware that if you are using  a matrix visual in order to use this column you need to make some "tricks", 

 

Add the measure to your values this will make a repeated value for each column you just need to resize all of the columns with conditional except one.

 

If you want to conditional format that column create the following measure:

Formatting = IF([Conditional column] = "full"; 1; 0)

And then use it's result to conditional formatting, check the image and file attach.

 

conditional column.png

 

Top table is matrix wiht hidden column, bottom is table in original format.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

Hi @Chan ,

 

Not really sure how you have your data setup but I'm assuming is simlar to this:

Employee  Name Attribute Value

1 A V1 2
1 A V2 2
1 A V3 2
1 A V4 2
2 B V1 2
2 B V2 2
2 B V3 1
3 C V1 1
3 C V2 2

 

If this is the case then you need to add a measure that looks like this:

Conditional column =
IF (
    CALCULATE ( SUM ( Table1[Value] ); ALLEXCEPT ( Table1; Table1[Employee] ) ) >= 'Required Score'[Required Score Value];
    "Full";
    "Part"
)

 

If your table has one column per each V you should do somehting like this:

Conditional column =
IF (
    CALCULATE (
        SUM ( Table1[V1] ) + SUM ( Table1[V2] )
            + SUM ( Table1[V3] )
            + SUM ( Table1[V4] );
        ALLEXCEPT ( Table1; Table1[Employee] )
    ) >= 'Required Score'[Required Score Value];
    "Full";
    "Part"
)

 

Be aware that if you are using  a matrix visual in order to use this column you need to make some "tricks", 

 

Add the measure to your values this will make a repeated value for each column you just need to resize all of the columns with conditional except one.

 

If you want to conditional format that column create the following measure:

Formatting = IF([Conditional column] = "full"; 1; 0)

And then use it's result to conditional formatting, check the image and file attach.

 

conditional column.png

 

Top table is matrix wiht hidden column, bottom is table in original format.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Chan
Regular Visitor

Great!!

 

It works fine now.

 

Thanks for your support  MFelix .

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.