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

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.

Reply
Nese_FZ
Helper I
Helper I

OFFSET - understanding behavior in the context filters

Good afternoon, Could anyone help me understand the behavior of this new offset function considering the filters applied to the measurements used?

The "SALDO INICIAL 2" column should bring the previous value of the "SALDO ACUM" column, but only a few lines are returning.

 

SALDO INICIAL 2 =
CALCULATE([SALDO ACUM],
OFFSET(1,ALLSELECTED(SaudeDigital[LINHA]),
ORDERBY(SaudeDigital[LINHA], DESC)))
 
SALDO ACUM =
VAR MaxIndice = Max(SaudeDigital[LINHA])
return
CALCULATE([Variação],
FILTER(ALL(SaudeDigital), SaudeDigital[LINHA] <= MaxIndice), SaudeDigital[NRUBRICA] = "UN. SAÚDE DIGITAL")
 
Considering that I already have an external filter applied on this page....
 
Nese_FZ_0-1678732932612.png

thanks a lot for the help

5 REPLIES 5
Nese_FZ
Helper I
Helper I

Thanks Brian, but it didn't work. It's not that context. From what I'm seeing, what's influencing the behavior is the SALDO ACUM measure, because if I insert removefilters the problem is solved. But then I can't apply external filters (month for example)

Provide sample data, Ill take a stab at it.  I have worked with it before and have had success.

Your problem is not in the Offset.  If you are able to dimensionalize the transaction table where LINHA is a dimension along with the Nrubrica and Descricao da conta is as well.  I don't know the data enough, but know that in the offset you are using an all selected becuase of duplicate records, but in the ACUM you have specific filter criteria.

 

BrianConnelly
Resolver III
Resolver III

Please read the article....Introducing window functions in DAX - SQLBI

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.