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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
paolomint
Helper III
Helper III

Dynamic title from multiple selections of the same slicer

Hi everyone,

 

My model has 2 filters on all pages: a QUARTER slicer and a YEAR slicer

I need to write a meansure (to use as a TITLE for several pages) to obtain the following results:

 

ACTIONRESULT OF THE MEASURE
NO QUARTER selection  - YEAR SELECTION = 2020REFERENCE PERIOD: 2020 
ONE QUARTER selection (Q1) - YEAR = 2020REFERENCE PERIOD: 2020 - Q1
TWO QUARTER selections (Q1/Q2) - YEAR = 2020 REFERENCE PERIOD: 2020 - Q1/Q2
THREE QUARTER selections (Q1/Q2/Q3) - YEAR = 2020REFERENCE PERIOD: 2020 - Q1/Q2/Q3
FOUR QUARTER selections (Q1/Q2/Q3/Q4) - YEAR = 2020REFERENCE PERIOD: 2020 

  

I hope someone can help me

thanks for your attention

bye

Paolo 

 

 

 

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

Hi @paolomint ,

 

You could use ISFILTERED() and ALLSELECTED() to get slicer status. Here is my result.

1-1.PNG

Here is my test file for your reference.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

4 REPLIES 4
v-eachen-msft
Community Support
Community Support

Hi @paolomint ,

 

You could use ISFILTERED() and ALLSELECTED() to get slicer status. Here is my result.

1-1.PNG

Here is my test file for your reference.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

Hi @v-eachen-msft 

thank you very much, love your solution

I put it in my model, it works but I see a strange things, never seen before.

 

The result of the measure is 2020 when quarter are selected (eg 2020 - Q1/Q2) but is 2,020.00 when quarter are not selected.

As you can see on the picture, I can't change the data type (TESTO = TEXT) or the format. 

What's happened in your opinion?

Thanks for your support

20200804_155512.jpg

 

amitchandak
Super User
Super User

@paolomint , Are trying YTD ?

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

 

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 :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...


Appreciate your Kudos.

Greg_Deckler
Super User
Super User

@paolomint - See if this helps: https://community.powerbi.com/t5/Quick-Measures-Gallery/The-Most-Amazing-Mind-Blowing-Dynamic-Slicer...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.