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

Date filter is not working in my DAX

Hi Folks, 

I have following DAX syntax, which is working fine but, when I'm trying the date slicer and filter it is not changing the table values and output. I tried to add date filter inside the DAX but somehow I am not able to figure it out. 

 

 

 

 

 

 

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)

 

 

 

Could you please me in implementing the date filter ?

 

Here is table output I'm getting from the Query but when imposing date filter it is not changing my outputs.

 

IndexFundPriceDateMeasureMeasure 2Measure 3
1A1081/1/2019 0:001108 
2A101.521/2/2019 0:001108-0.06
3A107.61121/3/2019 0:0011080
4A96.850081/4/2019 0:001108-0.1
5A99.755581/5/2019 0:001108-0.08
6A109.73111/6/2019 0:0011080.02
7D1031/1/2019 0:007103 
8D98.881/2/2019 0:007103-0.04
9D100.85761/3/2019 0:007103-0.02
10D98.840451/4/2019 0:007103-0.04
11D89.944811/5/2019 0:007103-0.13
12D93.54261/6/2019 0:007103-0.09
13D86.059191/7/2019 0:007103-0.16
14D80.035051/8/2019 0:007103-0.22

 

1 ACCEPTED SOLUTION
v-gizhi-msft
Community Support
Community Support

hi,

 

According to your description, please try this measure.

Test = 
var a = CALCULATE(MIN(Table4[Index]),FILTER(ALLSELECTED(Table4),Table4[Fund]=MAX('Table4'[Fund])))
var b = CALCULATE(MAX(Table4[Price]),FILTER(ALLEXCEPT(Table4,Table4[Fund]),Table4[Index]=a))
 
return 
IF(MAX(Table4[Index])=a,BLANK(),MAX(Table4[Price])-b)

The result shows as follows.

a-10.PNG

Here is my pbix file.

pbix 

If you still have questions about this, please for free to let me know.

 

Best Regards,

Giotto Zhi

View solution in original post

1 REPLY 1
v-gizhi-msft
Community Support
Community Support

hi,

 

According to your description, please try this measure.

Test = 
var a = CALCULATE(MIN(Table4[Index]),FILTER(ALLSELECTED(Table4),Table4[Fund]=MAX('Table4'[Fund])))
var b = CALCULATE(MAX(Table4[Price]),FILTER(ALLEXCEPT(Table4,Table4[Fund]),Table4[Index]=a))
 
return 
IF(MAX(Table4[Index])=a,BLANK(),MAX(Table4[Price])-b)

The result shows as follows.

a-10.PNG

Here is my pbix file.

pbix 

If you still have questions about this, please for free to let me know.

 

Best Regards,

Giotto Zhi

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.