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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Alicia83B
Helper I
Helper I

Card visual shows MIN and MAX date YTD & PYTD

I currently am using a text box to capture the sales period. I would like to move away from manually updating this box every month.  

Text box currently looks like this:

           Sales Period
January – August 2022
January – August 2021

The below DAX measure results in the sales period 1/1/2022 – 8/31/2022

DAX: _AB CY Sales Period = MIN ('Calendar'[Date]) & " - " & MAX ( 'Calendar'[Date] )

DAX Results: 1/1/2022 – 8/31/2022

 

This is only producing half of what I need for the sales period. Can someone offer guidance on how I can achieve including the PY Sales Period with the CY Sales Period in the same card visual?

Below is the result I am looking to achieve. 

       Sales Period
1/1/2022 – 8/31/2022
1/1/2021 – 8/31/2021

 

If it helps, I currently am using CurYearOffset is 0 and CurMonOffset is less than or equal to -3 and is greater than or equal to -15 for filters on my page. I also have a table that include CY and PY Sales data. 

 

Thank you in advance for looking at my question.

1 ACCEPTED SOLUTION
Alicia83B
Helper I
Helper I

@v-mengzhu-msft  I have solved for this measure. 

 

Sales Period =
FIRSTDATE('Calendar'[Date]) & " - " & LASTDATE('Calendar'[Date]) & " " & FIRSTDATE('Calendar'[Date])-365 & " - " & LASTDATE('Calendar'[Date])-365
 
Below are my results when using Sales Period in a card visual. 
 
Alicia83B_0-1668191322455.png

 

View solution in original post

3 REPLIES 3
Alicia83B
Helper I
Helper I

@v-mengzhu-msft  I have solved for this measure. 

 

Sales Period =
FIRSTDATE('Calendar'[Date]) & " - " & LASTDATE('Calendar'[Date]) & " " & FIRSTDATE('Calendar'[Date])-365 & " - " & LASTDATE('Calendar'[Date])-365
 
Below are my results when using Sales Period in a card visual. 
 
Alicia83B_0-1668191322455.png

 

v-mengzhu-msft
Community Support
Community Support

Hi @Alicia83B ,

 

So your requirement is that you want to use card visual to display the maximum and minimum date values? Is there sample data available?

 

Best regards,

Community Support Team Selina zhu

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

@v-mengzhu-msft Yes, that is correct. I have the measure for the current year, but need help with the measure for the prior year. I don't have a sample data, but I can work on something to post later today. 

 

Thank you. 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Power BI Header Change

Power BI Header Update

Read about the exciting updates for the Power BI forum.

Top Solution Authors