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
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
v-jayw-msft
Community Support
Community Support

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.

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

2 REPLIES 2
v-jayw-msft
Community Support
Community Support

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.

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
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
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.