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
Anonymous
Not applicable

How to calculate the percentage of the average number of days late per controller

Hello,

 

I am trying to calculate the average number of days late per controller. E.g. Francis' average delay.

I tried to create a calculate column using DIVIDE(Abs(Days Late); No. of audits performed;0) but no. of audits performed is not coming up as a possible denominator. Could this be because "No. of audits" is from a different query?

 

Could you please help me 🙂 You may see the below snippets for reference

 

Thanks in advance,

 

AnneFields pane.PNG

 

 
 
 
 
 

Power bi.PNG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

You could try adding the following calculated column to your "Dates" dataset. 

 

Average number of days late =
VAR __divide =
    DIVIDE ( Dates[Days Late]; RELATED ( 'No of audits'[No. of audits preformed] ) )
RETURN
    IF (
        RELATED ( 'No of audits'[No. of audits preformed] ) = 0;
        Dates[Days Late];
        __divide
    )

 

 

If this doesn't produce the correct results, could you give me an example of what output you would expect in the following scenario:
Dates

ControllerDays Late

John

-500
John-100

 

No of audits

ControllerNo of audits
John10

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Add a calculated column on the "no of audits" dataset. 

 

 

 

Average number of days late =
VAR __divide =
    DIVIDE ( RELATED ( Dates[Days Late] ); 'No of audits'[No. of audits preformed] )
RETURN
    IF (
        'No of audits'[No. of audits preformed] = 0;
        RELATED ( Dates[Days Late] );
        __divide
    )

 

 

Anonymous
Not applicable

When I enter:

Average number of days late =
Var_divide=
Divide(Related(

 

No possible columns come up in the related function.

 

Do you know why this is ?

 

Thanks 

 

Anne

Anonymous
Not applicable

Do you have a relationship set up between the two datasets? 

Karlos_0-1597920188202.png

@Anonymous 

Take a look at the sample PBIX file that I've created. 

https://1drv.ms/u/s!AnIEh6WhI4Jogr5cTQhBacsSJue5kg?e=lkevpn

 

Anonymous
Not applicable

@Anonymousthanks so much for your help so far!

 

There is a one to many relationship between dates and no. of audits - I think this may be why the formula isnt working. 

If I create a calculated column in the dates table I can choose columns in the no of audits table but not the other way around , only in this direction.

Please see below snippet for reference.

 

relationship.PNG

Anonymous
Not applicable

You could try adding the following calculated column to your "Dates" dataset. 

 

Average number of days late =
VAR __divide =
    DIVIDE ( Dates[Days Late]; RELATED ( 'No of audits'[No. of audits preformed] ) )
RETURN
    IF (
        RELATED ( 'No of audits'[No. of audits preformed] ) = 0;
        Dates[Days Late];
        __divide
    )

 

 

If this doesn't produce the correct results, could you give me an example of what output you would expect in the following scenario:
Dates

ControllerDays Late

John

-500
John-100

 

No of audits

ControllerNo of audits
John10

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.