Forum Discussion

Kyle-92's avatar
Kyle-92
Frequent Visitor
6 years ago

Submissions needed

Hi All

 

Someone provided assistance to me with calculating submissions. In essence my organisation requires individuals to submit a report every single week so we track actual submissions over required submissions. This KPI is monitored against both the individual and the manager they report to. 

In essence:

-An individual is expected to submit 10 reports but only submitted 5

-A manager has 3 individuals reporting to him/her and is therefore expected to have 30 submissions.

 

What needs to be taken into account is when the person is hired and leaves as submissions cant be required before their joining and after they leave so in the individual mastersheet we have the following columns a name, manager of the person, joining date and exit date.

 

The DAX I have at the moment is as follows:

 

Required Submissions =

 

VAR _First=FIRSTDATE('Calender'[Week End Date])

VAR _Last=LASTDATE(Calender'[Week End Date])

VAR _EFirst=MIN(Mastercode[Hiring Date])

VAR _ELast=MIN(Mastercode[Exit Date])

VAR _Start=MAX(_First,_EFirst)

VAR _End=IF(ISBLANK(_ELast),_Last,MIN(_Last,_ELast))

VAR _Check= _Start&"|"&_End&"|"&DATEDIFF(_Start,_End,WEEK)+1

VAR Result = MAX(0,DATEDIFF(_Start,_End,WEEK)+1)

 

Return

 

SUMX(

VALUES(Mastercode[Individual Name]),

CALCULATE(Result)

 

The issue arising at the moment is if we are tracking managers required submissions and they have one individual that has left it assumes all individuals have. I know this has to be an issue where iteration is required I am just not sure how to tackle it.

 

Really appreciate the assistance everyone!

9 Replies

  • V-lianl-msft's avatar
    V-lianl-msft
    Community Support
    Hi Kyle-92 ,

     

    It is very difficult to analyze without looking at the data and just by imagining. See if you can paste the image of the chart representing any sample data.But if it's an iterative loop problem, DAX can't solve it yet.

     

    Best Regards,
    Liang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    • Kyle-92's avatar
      Kyle-92
      Frequent Visitor

      Hi V-lianl-msft 

       

      My apologies wanted to see if there was an easy fix which I was missing rather then deleting a lot of confidential info. Please see attached a sample file which shows the dax where there are actual submissions but the required submissions are 0.

       

      Thanks for your help

       

      https://1drv.ms/u/s!AqSC3CpjQTrTr3_HsL-JfVqPi207 


      V-lianl-msft wrote:
      Hi Kyle-92 ,

       

      It is very difficult to analyze without looking at the data and just by imagining. See if you can paste the image of the chart representing any sample data.But if it's an iterative loop problem, DAX can't solve it yet.

       

      Best Regards,
      Liang
      If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

       



      V-lianl-msft wrote:
      Hi Kyle-92 ,

       

      It is very difficult to analyze without looking at the data and just by imagining. See if you can paste the image of the chart representing any sample data.But if it's an iterative loop problem, DAX can't solve it yet.

       

      Best Regards,
      Liang
      If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

       


       

      • V-lianl-msft's avatar
        V-lianl-msft
        Community Support
        Hi Kyle-92
         
        Is this the result you want?

        If yes,please refer to the DAX:
         

         

         

        Measure 2 =
        SUMX (
            VALUES ( Mastercode[Advisor Code] ),
            CALCULATE (
                VAR current_S_date =
                    SELECTEDVALUE ( Calender[Week Start Date] )
                VAR current_E_date =
                    SELECTEDVALUE ( Calender[Week End Date] )
                VAR current_status =
                    IF (
                        MAX ( Mastercode[Hiring Date] ) <= current_E_date
                            && MAX ( Mastercode[Exit Date] ) >= current_E_date,
                        1,
                        IF (
                            MAX ( Mastercode[Hiring Date] ) <= current_E_date
                                && ISBLANK ( MAX ( Mastercode[Exit Date] ) ),
                            1
                        )
                    )
                RETURN
                    current_status
            )
        )

         

         

        If the problem persists,please tell me the result you want

         
        Best Regards,
        Liang
        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.