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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Nogstai
Helper I
Helper I

TOTALYTD in current date shown in card visual

Hi Team,

 

I'm trying to get the YTD Totals as of today()'s date shown in cards, but it's only showing the overall total. The idea is it automatically based on the current date. For example below, it's May 15, the YTD should be 217M (not including the blanks).

 

Nogstai_0-1715765485172.png

Is there a way to do this? I have several other cards related to this that I need to be able to only show the totals as of today.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Nogstai ,

Option 1

YTD Today =
var _min = eomonth(today(),-1*month(today()))+1
var _max = today()
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

If date is selected

 

YTD Today =
var _min = eomonth(today(),-1*month(today()))+1
var _max = today()
return
CALCULATE([Net], FILTER(all('Date'),'Date'[Date] >=_min && 'Date'[Date] <= _max))

 

 

Use selected date else today

 

YTD =
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min = eomonth(_max,-1*MONTH(_max))+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))

 

All About Time Intelligence around Today: https://youtu.be/gcLhhxhXKEI

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Nogstai ,

Option 1

YTD Today =
var _min = eomonth(today(),-1*month(today()))+1
var _max = today()
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

If date is selected

 

YTD Today =
var _min = eomonth(today(),-1*month(today()))+1
var _max = today()
return
CALCULATE([Net], FILTER(all('Date'),'Date'[Date] >=_min && 'Date'[Date] <= _max))

 

 

Use selected date else today

 

YTD =
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min = eomonth(_max,-1*MONTH(_max))+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))

 

All About Time Intelligence around Today: https://youtu.be/gcLhhxhXKEI

Hi @amitchandak ,


Just going back here, I'm trying to undersand each DAX you created and why was it put there. I was trying to understand each line and I know the functions, but together it didn't make sense. Can you help me understand each? I don't just want to copy it, I want to see the logic for it.

 

Option 1

YTD Today =
var _min = eomonth(today(),-1*month(today()))+1
var _max = today()
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

The first one completely worked! I appreciate that and I also watched your tutorial, big help in getting YTD results for my dashboard!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.