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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Differences between first row and other rows along with the date slicers. Need DAX measure trick

 

 Hi Folks,

 

I am trying to get the difference between first rows and others along with the date slicer and other filters. I have some categories and date filter. So, whenever user selects date and the categories the table shows the filter data and I want to compute the differences between the first row of the filtered data and rest rows of the filtered data without combining the computation for both/multiple categories. Here is the table that I'm expecting. I am trying to create one measure but it is not working. 

Please suggest me the way. Thanks 

 
READY COLUMNTo Calculate the NEW Columns
IndexFundReturnPriceDateStart (Sno = 3)
1A0.081081/1/2019 
2A-0.06101.521/2/2019 
3A0.06107.61121/3/2019 
4A-0.196.850081/4/2019-0.1
5A0.0399.75558241/5/2019-0.073
6A0.1109.73114061/6/20190.0197
7D0.031031/1/2019 
8D-0.0498.881/2/2019 
9D0.02100.85761/3/2019 
10D-0.0298.8404481/4/2019-0.040384
11D-0.0989.944807681/5/2019-0.12674944
12D0.0493.542599991/6/2019-0.091819418
13D-0.0886.059191991/7/2019-0.164473864
14D-0.0780.035048551/8/2019-0.222960694
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

If i understand you correctly, ALLEXCEPT() function might be helpful for you.

Please refer to measure below and see if the result achieve your expectation:

Measure 3 = 
var a = CALCULATE(MIN('Table'[Index]),ALLEXCEPT('Table','Table'[Fund]))
var b = CALCULATE(MAX('Table'[Price]),FILTER(ALLEXCEPT('Table','Table'[Fund]),'Table'[Index] = a))
return
IF(MAX('Table'[Index])=a,BLANK(),MAX('Table'[Price])-b)

1.PNG

BTW, pbix as attached, hopefully works for you.

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

If i understand you correctly, ALLEXCEPT() function might be helpful for you.

Please refer to measure below and see if the result achieve your expectation:

Measure 3 = 
var a = CALCULATE(MIN('Table'[Index]),ALLEXCEPT('Table','Table'[Fund]))
var b = CALCULATE(MAX('Table'[Price]),FILTER(ALLEXCEPT('Table','Table'[Fund]),'Table'[Index] = a))
return
IF(MAX('Table'[Index])=a,BLANK(),MAX('Table'[Price])-b)

1.PNG

BTW, pbix as attached, hopefully works for you.

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thanks for your help. 

 It works for my dashboard. But when i'm trying to use the date slicer and other filters it is still taking the first value only. e.g if I choose date slicer from 01/03/2019 the current query is still considering the 01/01/2019 as base date and changing it to the 01/03/2019. Could you please help me in this? THnaks

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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