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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
danielhough
Helper II
Helper II

DAX for Earliest date and PY date in same column

Hey guys! I need to create table which only has two rows, two columns. Fist column says, "vs Prior Year" and the second column are the two dates: Current Date, (Current date - 365). IE : 

 

vs Prior Year  |  Date

vs Prior Year  | 9/1/2018

vs Prior Year  | 9/1/2019

 

These dates are derrived from the table : 'HFM_Data_QTD(5 quarters)_102319'

 

Is this even possible?

 

Thanks!!!

 

4 REPLIES 4
v-juanli-msft
Community Support
Community Support

Hi @danielhough 

Would you like to show a table as below:

If so, create measures

current sales = SUM('Table'[sales])

Prior Year's sales = CALCULATE(SUM('Table'[sales]),SAMEPERIODLASTYEAR('date'[Date]))

difference = [current sales]-[Prior Year's sales]

Capture6.JPG

If not, please let me know more details.

 

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for your help Maggie, I would like the table to look just like this:

 

vs Prior Period  |  Date

vs Prior Year     |   9/1/2018

vs Prior Year     |   9/1/2019

vs Prior Qtr       |   9/1/2019

vs Prior Qtr       |   6/1/2019

 

This will allow me to have a two button Chiclet slicer to filter the data by PQ or PY, but I need the dates to be dynamicly calculated as new data is refreshed. This works at them moment in static form. 

Hi @danielhough 

Sorry, i don't understand how to get this result.

Current date is 2019/12/17, but your date is 2019/9/1,

Could you tell me more about the rule of your table?

 

Best Regards
Maggie

Sure @v-juanli-msft, the current date, is today's date, but the data in the table is of the last quarter. Its financial data, loaded quarterly and I need to create a slicer which selects the date ranges for comparison. 

 

Thanks!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.