cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Nihed
Helper III
Helper III

Help dax

Hello,

 

how can I grieve only the date on yellow by YTD-1

Nihed_0-1648669044522.png

Thank you.

4 REPLIES 4
Whitewater100
Solution Sage
Solution Sage

Hi:

I don't see your table name, what you want to calculate, etc,, But you can try to do the following to obtain a YTD result.

Develope Calc Cols in Table YEAR = YEAR[Response date])

                                              Month No. = MONTH([Response Date])
                                              Month = FORMAT([Response date], "MMM")

YTD X = 
var curryear = MAX(Table[Year])
var currdate = MAX(Table[Response date])
return
Calculate( 
              [X], 
Table[Response date] <= currdate, 
Table[Year] = currYear, 
ALL(Table[Month}), 
ALL(Table[Month No]))

 

YTD LY = CALCULATE([YTD X], SAMEPERIODLASTYEAR(Dates[Date]))  * Need qualified date table. If you have this than YTD can simply be:

 

YTD X = CALCULATE({X], 
               DATESYTD(Dates'Date])   or change first year variable above to var Lyear = MAX(Table[Year])-1

 

I hope this helps.

I want just display "YTD N-1" in the column has the place of the date which is in yellow (2021)

Hi @Nihed ,

 

Please try:

Col = IF(Year('Table'[Response Date]) = 2021,"YTD N-1",'Table'[Response Date])


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

Hi:

Can you try this.

 

Replace = IF(Dates[Date] <= DATE(2021,12,31), SUBSTITUTE(Dates[Date], Dates[Date], "LYYTD"))

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors