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
PatilPrasad027
Resolver I
Resolver I

First Month of the year which is selected from slicer

Hi Community..!!

I want to display first month of the year where i will be selecting the month from slicer.

Ex : I have selected Dec-23 from slicer then first month for Dec-23 is Jan-23

If i have selected Mar-23 from the slicer then first month for Mar-23 will be Jan-23 and so on..

I want to display it in card visual.

How do we do it by writing DAX.

could u please help me to resolve this.

 

Thanks in advance..!!

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

Hi @PatilPrasad027 , Hello @amitchandak ,Thank you for your prompt reply.

 

Based on my understanding, you want to display date in the first month of the year when you select different dates in slicer.

 

Per my test, we can create a Measure to display target date in Card visual as shown below:

 

 

Measure = VAR firstMonthofYear="Jan" 
VAR currentday=DAY(SELECTEDVALUE('Table'[Date])) 
Return 
CONCATENATE(firstMonthofYear,CONCATENATE("-",currentday))

 

 

Please note that I changed the slicer as Vertical list and check the Single select on:

vyajiewanmsft_1-1718852927051.png

Result for your reference:

vyajiewanmsft_0-1718852724193.png

Best Regards,

Joyce,

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

 

 

View solution in original post

4 REPLIES 4
v-yajiewan-msft
Community Support
Community Support

Hi @PatilPrasad027 , Hello @amitchandak ,Thank you for your prompt reply.

 

Based on my understanding, you want to display date in the first month of the year when you select different dates in slicer.

 

Per my test, we can create a Measure to display target date in Card visual as shown below:

 

 

Measure = VAR firstMonthofYear="Jan" 
VAR currentday=DAY(SELECTEDVALUE('Table'[Date])) 
Return 
CONCATENATE(firstMonthofYear,CONCATENATE("-",currentday))

 

 

Please note that I changed the slicer as Vertical list and check the Single select on:

vyajiewanmsft_1-1718852927051.png

Result for your reference:

vyajiewanmsft_0-1718852724193.png

Best Regards,

Joyce,

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

 

 

Thank u so much @v-yajiewan-msft 😊

amitchandak
Super User
Super User

@PatilPrasad027 , What I am getting, you need YTD, year till date. then you can use Time intelligence

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))

 


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))

 

Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

 

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi @amitchandak 
Thanks for the quick responce..!!

I do not need YTD 

Just i need to display month in the card visual.

I have explained my requirement in details in my question.

 

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!

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.