Forum Discussion
brockry1
Helper II
1 year agoAdding column to display the Month Parameters
I have added a time period selectionfor the previous 1, 3, 6, 13 to display different views of the data. I feel like the calendar hierarchy can be confusing if I don't show a visula of the periods t...
brockry1
Helper II
1 year agoI tried using the above:
Selected Periods =
VAR SelectedPeriod = SELECTEDVALUE('N Months'[Previous N Months])
VAR Periods =
CALCULATE(
CONCATENATEX(
TOPN(SelectedPeriod, 'Account Data', 'Account Data'[RanksByYearMonth], DESC),
'Account Data'[YearMonthValue],","
),
ALLSELECTED('Account Data'[YearMonthValue])
)
RETURN "Selected Periods: " & Periods
and it returns this error.
Anonymous
1 year agoNot applicable
Hi brockry1
"Previous 1" is of Text data type while TopN function requires an integer number as the first parameter, that's why you got this error. To resolve it, you can modify the measure to extract the number of periods and convert it into a number:
Selected Periods =
VAR SelectedPeriod = VALUE( TRIM( RIGHT( SELECTEDVALUE('N Months'[Previous N Months]), 2)))
VAR Periods =
CALCULATE(
CONCATENATEX(
TOPN(SelectedPeriod, 'Account Data', 'Account Data'[RanksByYearMonth], DESC),
'Account Data'[YearMonthValue],","
),
ALLSELECTED('Account Data'[YearMonthValue])
)
RETURN "Selected Periods: " & Periods
Best regards,
Jing