Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
fpennisi
Regular Visitor

"Time intelligence" for non-time dimension

Hi,

I'm working with a NBA Dataset. 

I have a table showing the season, where a Season as an ID which is the starting year of the season (e.g. for season 2023/24 the ID is 2023).

 

I would like to show, for a given season, player averages related to the previous one.

I created the measure highlited below, that takes the average minutes overall (it's another measure) and calculates for the previous season of the selected one:

 

fpennisi_0-1728732853666.png

 

But the measure is not shown and I think that the reason is that the filter context of each row has the season set to the selected one, while the measure takes the values of another season.

How can I correct the measure to get the desired result?

2 ACCEPTED SOLUTIONS

Sure:

 

MIN = AVERAGE('NBA box score - Player'[TMIN])
Selected season = SELECTEDVALUE('NBA season'[SeasonID])
 
'NBA box score - Player' is the table with player stats by game.

'NBA season' is the dimension table of the seasons (just a plain list of "Season" / "SeasonID").

View solution in original post

Hi @fpennisi ,

 

Thank you for the clarification. I encountered a similar issue where the previous month's values didn’t appear when the current month filter was applied in the row fields. I believe the formula below will resolve this issue. 

EoPS MIN Previous Season = 
VAR CurrentSeason = SELECTEDVALUE('NBA season'[Season ID])
VAR PreviousSeason = CurrentSeason - 1
RETURN
    CALCULATE(
        [MIN],
        FILTER(
            ALL('NBA season'),
            'NBA season'[Season ID] = PreviousSeason
        )
    )

 

The reason the previous formula returned blank rows is that when you use a matrix visual with the current season in the row field, Power BI automatically applies a filter to show only the current season. This means that for each row in the visual, only data for the selected season is considered. The filter context created by the visual restricts the data to the specific season in that row.

Your original formula was constrained by this filter context, which applied only to the current season.

 

Best regards,

 

View solution in original post

4 REPLIES 4
DataNinja777
Super User
Super User

Hi @fpennisi ,

 

To evaluate your formula, could you please share the measures [Selected season] and [MIN] with us?

 

Best regards,

 

Sure:

 

MIN = AVERAGE('NBA box score - Player'[TMIN])
Selected season = SELECTEDVALUE('NBA season'[SeasonID])
 
'NBA box score - Player' is the table with player stats by game.

'NBA season' is the dimension table of the seasons (just a plain list of "Season" / "SeasonID").

It worked perfectly!

I guessed it was for the reason you explained and a tried a couple of measures with ALL or REMOVEFILTERS, but I wasn't able to let them work.

Thank you!

Hi @fpennisi ,

 

Thank you for the clarification. I encountered a similar issue where the previous month's values didn’t appear when the current month filter was applied in the row fields. I believe the formula below will resolve this issue. 

EoPS MIN Previous Season = 
VAR CurrentSeason = SELECTEDVALUE('NBA season'[Season ID])
VAR PreviousSeason = CurrentSeason - 1
RETURN
    CALCULATE(
        [MIN],
        FILTER(
            ALL('NBA season'),
            'NBA season'[Season ID] = PreviousSeason
        )
    )

 

The reason the previous formula returned blank rows is that when you use a matrix visual with the current season in the row field, Power BI automatically applies a filter to show only the current season. This means that for each row in the visual, only data for the selected season is considered. The filter context created by the visual restricts the data to the specific season in that row.

Your original formula was constrained by this filter context, which applied only to the current season.

 

Best regards,

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.