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

Prior day's data over Calendar slicer selection

Good day,

 

 

 

Please suggest how to compare data (text field) yesterday Vs today

 

 

 

CounterpartyIdPriceReferenceDate 
110123ade23/01/2019 
223red12323/01/2019 
123456kkk24/01/2019 
254red12324/01/2019 
365mln32124/01/2019 
110888lk25/01/2019 
223090mln25/01/2019 
333mln32125/01/2019 
443909jkj25/01/2019 

 

I would like to compare "Reference" column Yesterday Vs Today based on Date filter slicer

 

 

 

I am expecting: When i select 24/01/2019, Calculated Column should show "Reference" values of previous day (23/01/2019)

 

Please help me out by providing DAX.

 

 

 

Thank you

3 REPLIES 3
Anonymous
Not applicable

@Anonymous Please create a measure as per below

Measure = 
VAR _selectedDate = SELECTEDVALUE('Table'[Date])
VAR _prevdate = CALCULATE(MAX('Table'[Date]),FILTER(ALL('Table'[Date]),'Table'[Date]<_selectedDate))
RETURN CALCULATE(MAX('Table'[Reference]),FILTER(ALLEXCEPT('Table','Table'[CounterpartyId]),'Table'[Date]=_prevdate))

 This will give you CounterpartyId wise previous date reference

Anonymous
Not applicable

Thank you so much.

I have applied DAX and it has returned nothing.

 

Thank you

Anonymous
Not applicable

@Anonymous  Sorry I missed one argument in allexcept function.

 

Measure = 
VAR _selectedDate = SELECTEDVALUE('Table'[Date])
VAR _prevdate = CALCULATE(MAX('Table'[Date]),FILTER(ALLEXCEPT('Table','Table'[CounterpartyId]),'Table'[Date]<_selectedDate))
RETURN CALCULATE(MAX('Table'[Reference]),FILTER(ALLEXCEPT('Table','Table'[CounterpartyId]),'Table'[Date]=_prevdate))

 Please create a measure as per above dax

shree.png 

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.

Top Solution Authors