Forum Discussion
Anonymous
6 years agoNot applicable
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 (...
- 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:
Best Regards,
Giotto ZHi
v-gizhi-msft
Community Support
6 years agoHi,
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:
Best Regards,
Giotto ZHi