Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I've got a [Season] table that looks like this...
I'm using this table as a slicer, and when a particular SeasonName is selected, I'd like to be able to be able to show the "next" season as a label for a visual. If I could create a computed column called "Next Season" like this, it would be ideal...
Is there any easy way to make this happen? I've been trying CALCULATE and FILTER, but haven't been able to get them to do reference the next row based on SeasonId.
I'm hoping this is a quicky and I'm just being myopic. PLEASE HELP!
Solved! Go to Solution.
You can use variables to help! This will be easy because you SeasonID is a serial ID column.
[Next Season] = VAR CurrentSeason = SELECTEDVALUE ( Table[SeasonName] ) VAR CurrentID = CALCULATE ( MIN ( Table[SeasonID] ), Table[SeasonName] = CurrentSeason ) VAR NextSeasonName = CALCULATE ( VALUES ( Table[SeasonName] ), Table[SeasonID] = CurrentSeason + 1 ) RETURN NextSeasonName
CurrentSeason grabs the name that's currently selected. CurrentID gets the serial number.
Then you grab the season name that corresponds to CurrentID + 1.
You can use variables to help! This will be easy because you SeasonID is a serial ID column.
[Next Season] = VAR CurrentSeason = SELECTEDVALUE ( Table[SeasonName] ) VAR CurrentID = CALCULATE ( MIN ( Table[SeasonID] ), Table[SeasonName] = CurrentSeason ) VAR NextSeasonName = CALCULATE ( VALUES ( Table[SeasonName] ), Table[SeasonID] = CurrentSeason + 1 ) RETURN NextSeasonName
CurrentSeason grabs the name that's currently selected. CurrentID gets the serial number.
Then you grab the season name that corresponds to CurrentID + 1.
When I apply this code, it gives this error: "A circular dependancy was detected..."
Why? and how to solve this issue?
Hi. How do we go about this if there is no index ID?
I've never used Variables like that before, so it took me a minute wrap my head around it. Working great now, thanks
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
94 | |
83 | |
67 | |
59 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |