The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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 and 2016 --random years
Sale year 2013 --one year
Solved! Go to Solution.
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!
This vdeo illustrates how to create a Dynamic title, in addition to Rankx
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.
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.
Please use the following dax measure:
SelectedYearValues =
VAR MaxYear =
MAX ( Dates[Year] )
VAR MinYear =
MIN ( Dates[Year] )
VAR Difference = ( MaxYear - MinYear ) + 1
VAR TotalSelectedValues =
DISTINCTCOUNT ( Dates[Year] )
RETURN
IF (
Difference > TotalSelectedValues,
CONCATENATEX ( VALUES ( Dates[Year] ), Dates[Year], ", " ),
IF (
Difference = TotalSelectedValues,
"Between " & MinYear & " and " & MaxYear,
IF ( HASONEVALUE ( Dates[Year] ), SELECTEDVALUE ( Dates[Year] ) )
)
)
Please let me know if this didn't help.
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!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
80 | |
80 | |
48 | |
40 |
User | Count |
---|---|
150 | |
110 | |
64 | |
64 | |
58 |