Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Infinity error

Hello,   I have some data about registrations to an online system. I want to create a measure showing the percentage of registrations out of the total population for a region, on a month-by-month (...
  • v-gizhi-msft's avatar
    6 years ago

    Hi,

     

    According to your description, i create three tables to test:

    Please take following steps:

    1)Create a measure:

    Measure = DIVIDE(COUNTROWS(Registrations),SUM(Regions[Population]))

    Choose a matrix visual and it shows:

    2)Create another measure:

    Measure 2 =
    VAR d =
        SELECTEDVALUE ( 'Year-Month'[Year-Month] )
    RETURN
        IF (
            COUNTROWS ( 'Registrations' ) = 0,
            VAR t =
                FILTER (
                    SUMMARIZE (
                        FILTER ( ALLSELECTED ( 'Year-Month' ), 'Year-Month'[Year-Month] < d ),
                        'Year-Month'[Year-Month].[Year],
                        'Year-Month'[Year-Month].[MonthNo],
                        "Number", CALCULATE ( COUNTROWS ( 'Registrations' ) )
                    ),
                    [Number] > 0
                )
            RETURN
                CALCULATE (
                    [Measure],
                    FILTER (
                        ALLSELECTED ( 'Registrations' ),
                        'Registrations'[Region] IN FILTERS ( 'Registrations'[Region] )
                            && MONTH ( 'Registrations'[Year-Month] ) = MAXX ( t, [Year-Month].[MonthNo] )
                            && YEAR ( 'Registrations'[Year-Month] ) = MAXX ( t, [Year-Month].[Year] )
                    )
                ),
            [Measure]
        )

    And it replace the original blank with previous month's data, the result shows:

    Here is my test pbix file:

    pbix 

     

    Best Regards,

    Giotto ZHi