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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Saitharunk
Frequent Visitor

Find the rating for employees Count of rating,Percentage , Tolerence Above , filter with department

Table 1 

Saitharunk_0-1681633426976.png

Table 2

Saitharunk_2-1681633998204.png

 

 

Requirement in power bi

with out filtering with Department the result in power bi.

Saitharunk_3-1681638398887.png

after filtering with Depatment with "Mech", the result showing in power bi.

Saitharunk_4-1681638488540.png

Can you please do this requirement in power bi and share me PBX file .

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Saitharunk ,

Please create measure with below dax formula:

Count of Rating =
VAR _rating =
    SELECTEDVALUE ( Table2[Rating] )
VAR tmp =
    FILTER ( ALLSELECTED ( Table1 ), [Rating] = _rating )
RETURN
    IF (
        HASONEVALUE ( Table2[Rating] ),
        COUNTROWS ( tmp ),
        COUNTROWS ( ALLSELECTED ( Table1 ) )
    )
Percentage =
VAR _a = [Count of Rating]
VAR _b =
    COUNTROWS ( ALLSELECTED ( Table1 ) )
RETURN
    DIVIDE ( _a, _b )
Tolerence =
VAR _a =
    SELECTEDVALUE ( Table1[Department] )
VAR tmp =
    CALCULATETABLE (
        VALUES ( Table1[Rating] ),
        FILTER ( ALL ( Table1 ), [Department] = _a )
    )
VAR _rating =
    SELECTEDVALUE ( Table2[Rating] )
VAR sum_te =
    CALCULATE ( SUM ( Table2[Toerance] ), ALL ( Table2 ) )
VAR _te =
    CALCULATE (
        SUM ( Table2[Toerance] ),
        FILTER ( ALL ( Table2 ), [Rating] = _rating )
    )
VAR _val =
    IF (
        NOT ( HASONEFILTER ( Table1[Department] ) ),
        DIVIDE ( _te, sum_te ),
        IF ( _rating IN tmp, DIVIDE ( _te, sum_te ) )
    )
RETURN
    IF ( HASONEVALUE ( Table2[Rating] ), _val, BLANK () )
Above Tolerence =
VAR _a = [Percentage]
VAR _b = [Tolerence]
VAR _val =
    IF ( _a > _b, "Yes", "No" )
RETURN
    IF ( HASONEVALUE ( Table2[Rating] ), _val, BLANK () )
Measure =
VAR _a =
    SELECTEDVALUE ( Table1[Department] )
VAR tmp =
    CALCULATETABLE (
        VALUES ( Table1[Rating] ),
        FILTER ( ALL ( Table1 ), [Department] = _a )
    )
VAR _rat =
    SELECTEDVALUE ( Table2[Rating] )
VAR _val =
    IF ( _rat IN tmp, 1 )
RETURN
    IF ( NOT ( HASONEFILTER ( Table1[Department] ) ), 1, _val )

vbinbinyumsft_0-1681784632114.png

Please refer the attaced .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Saitharunk ,

Please create measure with below dax formula:

Count of Rating =
VAR _rating =
    SELECTEDVALUE ( Table2[Rating] )
VAR tmp =
    FILTER ( ALLSELECTED ( Table1 ), [Rating] = _rating )
RETURN
    IF (
        HASONEVALUE ( Table2[Rating] ),
        COUNTROWS ( tmp ),
        COUNTROWS ( ALLSELECTED ( Table1 ) )
    )
Percentage =
VAR _a = [Count of Rating]
VAR _b =
    COUNTROWS ( ALLSELECTED ( Table1 ) )
RETURN
    DIVIDE ( _a, _b )
Tolerence =
VAR _a =
    SELECTEDVALUE ( Table1[Department] )
VAR tmp =
    CALCULATETABLE (
        VALUES ( Table1[Rating] ),
        FILTER ( ALL ( Table1 ), [Department] = _a )
    )
VAR _rating =
    SELECTEDVALUE ( Table2[Rating] )
VAR sum_te =
    CALCULATE ( SUM ( Table2[Toerance] ), ALL ( Table2 ) )
VAR _te =
    CALCULATE (
        SUM ( Table2[Toerance] ),
        FILTER ( ALL ( Table2 ), [Rating] = _rating )
    )
VAR _val =
    IF (
        NOT ( HASONEFILTER ( Table1[Department] ) ),
        DIVIDE ( _te, sum_te ),
        IF ( _rating IN tmp, DIVIDE ( _te, sum_te ) )
    )
RETURN
    IF ( HASONEVALUE ( Table2[Rating] ), _val, BLANK () )
Above Tolerence =
VAR _a = [Percentage]
VAR _b = [Tolerence]
VAR _val =
    IF ( _a > _b, "Yes", "No" )
RETURN
    IF ( HASONEVALUE ( Table2[Rating] ), _val, BLANK () )
Measure =
VAR _a =
    SELECTEDVALUE ( Table1[Department] )
VAR tmp =
    CALCULATETABLE (
        VALUES ( Table1[Rating] ),
        FILTER ( ALL ( Table1 ), [Department] = _a )
    )
VAR _rat =
    SELECTEDVALUE ( Table2[Rating] )
VAR _val =
    IF ( _rat IN tmp, 1 )
RETURN
    IF ( NOT ( HASONEFILTER ( Table1[Department] ) ), 1, _val )

vbinbinyumsft_0-1681784632114.png

Please refer the attaced .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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