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

CALULATE COUNT AND PERCENTAGE

EMPDATEPROJ
A1/1/2018P295
A1/2/2018P295
A1/3/2018P295
A1/4/2018P295
A1/5/2018P296
A1/6/2018P296
A1/7/2018P295
B1/1/2018P296
B1/2/2018P296
B1/3/2018P296
B1/4/2018P296
B1/5/2018P295
B1/6/2018P296
C1/1/2018P297
C1/2/2018P295
C1/3/2018 
C1/4/2018 
C1/5/2018P297
C1/6/2018P297
C1/7/2018P297

 

WE CHOOSE DATE BETWEEN FORM SLICER, FROM 1/1/2018 TO 1/7/2018. AFTER THAT WE CALCULATE THE WORKING DAYS BASED ON PROJECT AND ITS PERCENTAGE(NO OF DAYS/TOTAL DAYS*100) FOR PARTICULAR PROJECT WITH EMPLOYEE.

RESULT LIKE BELOW.

 

EMPPROJCOUNTPERCENTAGE
AP295571.43
AP296228.57
BP295116.67
BP295583.33
C 228.57
CP295114.29
CP297457.14
2 ACCEPTED SOLUTIONS
Zubair_Muhammad
Community Champion
Community Champion

 @sohailstsindia

 

May be a MEASURE like

 

Percentage =
COUNT ( TableName[DATE] )
    / CALCULATE ( COUNT ( TableName[DATE] ), ALLEXCEPT ( TableName, TableName[EMP] ) )

Regards
Zubair

Please try my custom visuals

View solution in original post

v-xjiin-msft
Solution Sage
Solution Sage

Hi @sohailstsindia,

 

In your scenario, you are using a date slicer to filter your data. Right?

 

If so, to achieve your requirement, you can create several measures with expression like below:

 

Count days based on Emp and Proj:

 

 

 

Count Days =
CALCULATE (
    COUNT ( 'Table'[DATE] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[EMP] = MAX ( 'Table'[EMP] )
            && 'Table'[PROJ] = MAX ( 'Table'[PROJ] )
    )
)

Count total days based on Emp.

 

Total Days =
CALCULATE (
    COUNT ( 'Table'[DATE] ),
    FILTER ( ALLSELECTED ( 'Table' ), 'Table'[EMP] = MAX ( 'Table'[EMP] ) )
)

Then the percentage will be:

 

Percentage = [Count Days]/[Total Days] 

For sure, you can combine above measures into one.

 

11.PNG

 

Thanks,
Xi Jin.

View solution in original post

4 REPLIES 4
v-xjiin-msft
Solution Sage
Solution Sage

Hi @sohailstsindia,

 

In your scenario, you are using a date slicer to filter your data. Right?

 

If so, to achieve your requirement, you can create several measures with expression like below:

 

Count days based on Emp and Proj:

 

 

 

Count Days =
CALCULATE (
    COUNT ( 'Table'[DATE] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[EMP] = MAX ( 'Table'[EMP] )
            && 'Table'[PROJ] = MAX ( 'Table'[PROJ] )
    )
)

Count total days based on Emp.

 

Total Days =
CALCULATE (
    COUNT ( 'Table'[DATE] ),
    FILTER ( ALLSELECTED ( 'Table' ), 'Table'[EMP] = MAX ( 'Table'[EMP] ) )
)

Then the percentage will be:

 

Percentage = [Count Days]/[Total Days] 

For sure, you can combine above measures into one.

 

11.PNG

 

Thanks,
Xi Jin.

Zubair_Muhammad
Community Champion
Community Champion

 @sohailstsindia

 

May be a MEASURE like

 

Percentage =
COUNT ( TableName[DATE] )
    / CALCULATE ( COUNT ( TableName[DATE] ), ALLEXCEPT ( TableName, TableName[EMP] ) )

Regards
Zubair

Please try my custom visuals

CALCULATE ( COUNT ( TableName[DATE] ), ALLEXCEPT ( TableName, TableName[EMP] )

its count full  data, i need to calculate perticular month data

@sohailstsindia

 

Ok. Try this one

 

Percentage =
COUNT ( TableName[DATE] )
    / CALCULATE (
        COUNT ( TableName[DATE] ),
        ALLEXCEPT ( TableName, TableName[EMP], TableName[DATE].[Month] )
    )

Regards
Zubair

Please try my custom visuals

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.