Forum Discussion
Measure count and median
- 1 year ago
Hi Lodan ,
The discrepancy you're seeing in the customer count and median MRR likely comes from how context is handled within your measures. The [MRR Revenue] measure involves multiple currency conversions and filters based on start and end dates. However, in your Client Count and Median MRR measures, you're summarizing the Combined table directly, which might not align with the way [MRR Revenue] is computed in the visual. To resolve this, you can explicitly calculate [MRR Revenue] for each customer, applying the same logic and filters, and then derive both the count and median from this list of customers with actual MRR values. Here's how you can rewrite the measures:
Current Customer Count = VAR MaxDate = CALCULATE( MAX( 'Dates2'[Date] ) ) VAR T1 = ADDCOLUMNS ( VALUES( Combined[Customer] ), "CustomerMRR", CALCULATE( [MRR Revenue], Combined[End Date] > MaxDate, Combined[Start Date] <= MaxDate, Combined[PON or Not] IN { "PON", "Excluded" } ) ) RETURN COUNTROWS( FILTER( T1, [CustomerMRR] > 0 ) )Median MRR = VAR MaxDate = CALCULATE( MAX( 'Dates2'[Date] ) ) VAR T1 = ADDCOLUMNS ( VALUES( Combined[Customer] ), "CustomerMRR", CALCULATE( [MRR Revenue], Combined[End Date] > MaxDate, Combined[Start Date] <= MaxDate, Combined[PON or Not] IN { "PON", "Excluded" } ) ) RETURN MEDIANX ( FILTER( T1, [CustomerMRR] > 0 ), [CustomerMRR] )These versions ensure that only customers contributing non-zero MRR values at the selected reporting date are included in the count and median calculations, matching exactly what’s displayed in your visual.
Best regards,
Hi Lodan ,
The discrepancy you're seeing in the customer count and median MRR likely comes from how context is handled within your measures. The [MRR Revenue] measure involves multiple currency conversions and filters based on start and end dates. However, in your Client Count and Median MRR measures, you're summarizing the Combined table directly, which might not align with the way [MRR Revenue] is computed in the visual. To resolve this, you can explicitly calculate [MRR Revenue] for each customer, applying the same logic and filters, and then derive both the count and median from this list of customers with actual MRR values. Here's how you can rewrite the measures:
Current Customer Count =
VAR MaxDate = CALCULATE( MAX( 'Dates2'[Date] ) )
VAR T1 =
ADDCOLUMNS (
VALUES( Combined[Customer] ),
"CustomerMRR",
CALCULATE(
[MRR Revenue],
Combined[End Date] > MaxDate,
Combined[Start Date] <= MaxDate,
Combined[PON or Not] IN { "PON", "Excluded" }
)
)
RETURN
COUNTROWS(
FILTER( T1, [CustomerMRR] > 0 )
)
Median MRR =
VAR MaxDate = CALCULATE( MAX( 'Dates2'[Date] ) )
VAR T1 =
ADDCOLUMNS (
VALUES( Combined[Customer] ),
"CustomerMRR",
CALCULATE(
[MRR Revenue],
Combined[End Date] > MaxDate,
Combined[Start Date] <= MaxDate,
Combined[PON or Not] IN { "PON", "Excluded" }
)
)
RETURN
MEDIANX (
FILTER( T1, [CustomerMRR] > 0 ),
[CustomerMRR]
)
These versions ensure that only customers contributing non-zero MRR values at the selected reporting date are included in the count and median calculations, matching exactly what’s displayed in your visual.
Best regards,
Thats fantastic thanks very much !
It worked a treat and I will remember that for future measures.
Best regards