Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Problem getting the right values for issues registered and closed

Hi there,

 

I have a question:

 

I am preparing an issue report where I have to visualize the following:

 

1. Date filter (let's consider the month of April 2020)

2. Calculate issues registered (Measure = SUM or Count issues based on register date)

3. Calculate issues closed (Measure = Sum or Count issues based on closing date)

4. Calculate issues before April = here I have problem: I am using the following measure:

 

Issues before selected month =
VAR registered =
CALCULATE (
[Issues Registered],
FILTER ( ALL ( 'Date' ), 'Date'[YearMonthNo] < MAX ( 'Date'[YearMonthNo] ) )
)

VAR Closed =
CALCULATE (
[Issues Closed],
FILTER ( ALL ( 'Date' ), 'Date'[YearMonthNo] < MAX ( 'Date'[YearMonthNo] ) )

 

RETURN

Result = Issues Registered - Issues Closed

 

4. Calculate issues end period = Issues begin period (Before April) + Issues registered - Issues Closed

 

What I try to do is:

I want to know how many issues were still not closed before SELECTEDMONTH April 

+

Issues registered in April

+

Issues Closed in April

+

Final Status = How many issues are not closed

 

 

I hope someone can help me. The scenario in Excel What I want to achieve in Power BI Desktop.

 

Thank you.

5 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      amitchandak 

       

      Thank you for your reply.

       

      I am aware of your comment but my request is quite different.

       

      I need to calculate all the issues before SELECTED Month APRIL.

       

      Please see carefully my case.

  • v-yingjl's avatar
    v-yingjl
    Community Support

    Hi Anonymous ,

    If you want to get the yellow expected result just consider April, why not calculate it directly.

    Sample data:

    Issue registered = SUM('Table'[Registered])
    Issue closed = SUM('Table'[Closed])
    Issue Registered April =
    CALCULATE ( [Issue registered], MONTH ( 'Table'[Date] ) = 4 )
    Issue Closed April =
    CALCULATE ( [Issue closed], MONTH ( 'Table'[Date] ) = 4 )
    Issue Registered < April =
    CALCULATE ( [Issue registered], MONTH ( 'Table'[Date] ) < 4 )
    Issue Closed < April =
    CALCULATE ( [Issue closed], MONTH ( 'Table'[Date] ) < 4 )
    Begin period = [Issue Registered < April] -[Issue Closed < April]
    End period = [Begin period] + [Issue Registered April] - [Issue Closed April]

    Result:

     

    Best Regards,
    Yingjie Li

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

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      v-yingjl 

       

      Thank you for your explanation

       

      I would like that " Before period" to be dynamic. means if I change the date range to MARCH then i should calculate all before March.

      • v-yingjl's avatar
        v-yingjl
        Community Support

        Hi Anonymous ,

        Try like this measure to calculate period month total by using the slicer:

        Issue Registered < selected month =
        VAR _month =
            SELECTEDVALUE ( 'Table'[Date].[MonthNo] )
        RETURN
            CALCULATE (
                [Issue registered],
                FILTER ( ALL ( 'Table' ), MONTH ( 'Table'[Date] ) < _month )
            )

        If you select March, it will calculate total registered based on Jan and Feb:

        Best Regards,
        Yingjie Li

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