Forum Discussion
rivera11115
3 years agoRegular Visitor
Dynamic card based on year slicer
Hi, I want the dynamic card to read as follows: Sales year between 2013 and 2016 -- only if a range of consecutive years are selected ex 2013,2014,2015 & 2016. Sales year for 2012, 2014, 2015 a...
- 3 years ago
Hi..thank you so much for helping out.
Your code works for the first two scenarios (see original question) but when a single year is chosen the year repeats in the header twice.
I was able to tweek your code a little and it works great thank you so much!
DateRange =VAR MaxYear =MAX ( 'Calendar'[Year])VAR MinYear =MIN ( 'Calendar'[Year] )VAR Difference = ( MaxYear - MinYear ) + 1VAR TotalSelectedValues =DISTINCTCOUNT ( 'Calendar'[Year] )RETURNIF(TotalSelectedValues= 1, "Sales Year " & CONCATENATEX (VALUES ( 'Calendar'[Year] ), 'Calendar'[Year], " " ),IF (Difference > TotalSelectedValues,"Sales Year for " & CONCATENATEX ( VALUES ('Calendar'[Year] ), 'Calendar'[Year], ", " ),IF (Difference = TotalSelectedValues,"Sales Year Between " & MinYear & " and " & MaxYear,IF ( HASONEVALUE ('Calendar'[Year]), SELECTEDVALUE ( 'Calendar'[Year] ) ))))
Anonymous
3 years agoNot applicable
Hello rivera11115 ,
You can try out by using the following measure
_Title =
Var YearSeries = SUMX(
SELECTCOLUMNS(
GENERATESERIES(MIN(date[The_Year]),MAX(date[The_Year]),1),
"Series",[Value]
),
[Series]
)
VAR T1 = CONCATENATEX(VALUES(date[The_Year]),date[The_Year],",")
VAR T2 = CONCATENATE(CONCATENATE(MIN(date[The_Year])," and "),MAX(date[The_Year]))
Var SelYears = SUMX(VALUES(date[The_Year]),date[The_Year])
VAR FinalTitle = IF ( YearSeries=SelYears ,CONCATENATE(" between ",T2),CONCATENATE(" for ",T1))
RETURN
CONCATENATE("Sales year",FinalTitle)
Output
If this measures helps, then please consider Accept it as the solution to help the other members find it more quickly.
- rivera111153 years agoRegular Visitor
Hi..thank you so much for helping out.
Your code works for the first two scenarios (see original question) but when a single year is chosen the year repeats in the header twice.