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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
LD1
Helper III
Helper III

Display a title that depends on selected values by month

Hi everyone, 

I would like to display in a dax formula the selection "From January to March" for example. (It depends on the selected values)

 

The reference table : 

 

January, February, etc.

 

 

I tried this one but it doesn't work : 

 

Affichage filtre sélection mois = "From " & MIN(SELECTEDVALUE(Calendrier[Num Mois])) & " to " & MAX(SELECTEDVALUE(Calendrier[Num Mois]) & SELECTEDVALUE('Année PM'[Year]))
 
Thank you in advance for your help, 
 
Have a good day. 
 
LD
2 ACCEPTED SOLUTIONS
Nasif_Azam
Super User
Super User

Hey  @LD1 ,

To display a dynamic title based on the selected values for months and years, you need to handle the SELECTEDVALUE() function carefully and ensure the correct format. Try the updated version of your DAX formula:

Affichage filtre sélection mois = 
"From " & 
FORMAT(MIN(SELECTEDVALUE(Calendrier[Num Mois])), "MMMM") & 
" to " & 
FORMAT(MAX(SELECTEDVALUE(Calendrier[Num Mois])), "MMMM") & 
" " & 
SELECTEDVALUE('Année PM'[Year])

 

If there is only one month selected, both MIN and MAX will return the same month, so it will show "From January to January" (if only January is selected).

 

 

If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.


Best Regards,
Nasif Azam



Did I answer your question?
If so, mark my post as a solution!
Also consider helping someone else in the forums!

Proud to be a Super User!


LinkedIn

View solution in original post

v-pnaroju-msft
Community Support
Community Support

Thankyou, @FBergamaschi@Nasif_Azam and @techies for your responses.

Hi LD1,

We sincerely appreciate your inquiry submitted through the Microsoft Fabric Community Forum.

Based on my understanding, we have developed a DAX measure that dynamically selects the minimum and maximum month numbers, maps them to their respective month names, and appends the selected year to display a dynamic title.

Please find attached a screenshot and a sample PBIX file which may assist you in resolving the issue:

vpnarojumsft_0-1754050557424.png

We hope that the information provided will be helpful. Should you have any further queries, please do not hesitate to contact the Microsoft Fabric Community.

Thank you.

View solution in original post

7 REPLIES 7
v-pnaroju-msft
Community Support
Community Support

Hi LD1,

We wanted to see if the information we gave helped fix your problem. If you need more help, please feel free to contact the Microsoft Fabric community.

Thank you.

v-pnaroju-msft
Community Support
Community Support

Hi LD1,

We are following up to see if what we shared solved your issue. If you need more support, please reach out to the Microsoft Fabric community.

Thank you.

v-pnaroju-msft
Community Support
Community Support

Hi LD1,

We would like to follow up and see whether the details we shared have resolved your problem.
If you need any more assistance, please feel free to connect with the Microsoft Fabric community.

Thank you.

v-pnaroju-msft
Community Support
Community Support

Thankyou, @FBergamaschi@Nasif_Azam and @techies for your responses.

Hi LD1,

We sincerely appreciate your inquiry submitted through the Microsoft Fabric Community Forum.

Based on my understanding, we have developed a DAX measure that dynamically selects the minimum and maximum month numbers, maps them to their respective month names, and appends the selected year to display a dynamic title.

Please find attached a screenshot and a sample PBIX file which may assist you in resolving the issue:

vpnarojumsft_0-1754050557424.png

We hope that the information provided will be helpful. Should you have any further queries, please do not hesitate to contact the Microsoft Fabric Community.

Thank you.

techies
Super User
Super User

Hi @LD1 what is in the 'Année PM' table?

 

 

― Power BI | Microsoft Fabric | PL-300 | DP-600 | Blog: medium.com/@cseprs_54978
Nasif_Azam
Super User
Super User

Hey  @LD1 ,

To display a dynamic title based on the selected values for months and years, you need to handle the SELECTEDVALUE() function carefully and ensure the correct format. Try the updated version of your DAX formula:

Affichage filtre sélection mois = 
"From " & 
FORMAT(MIN(SELECTEDVALUE(Calendrier[Num Mois])), "MMMM") & 
" to " & 
FORMAT(MAX(SELECTEDVALUE(Calendrier[Num Mois])), "MMMM") & 
" " & 
SELECTEDVALUE('Année PM'[Year])

 

If there is only one month selected, both MIN and MAX will return the same month, so it will show "From January to January" (if only January is selected).

 

 

If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.


Best Regards,
Nasif Azam



Did I answer your question?
If so, mark my post as a solution!
Also consider helping someone else in the forums!

Proud to be a Super User!


LinkedIn
FBergamaschi
Solution Sage
Solution Sage

Hi @LD1 

SELECTEDVALUE() returns the only visibile value of a column in the current filter context (or a BLANK if there is more than one value is visible - or the optional second input if you want something different than BLANK in case of multiple values), so it does not apply to any MIN/MAX

 

Without more info on your model, I can only suggest to use

 

Affichage filtre sélection mois = "From " & MIN(Calendrier[Num Mois]) & " to " & MAX(Calendrier[Num Mois]) & " " & SELECTEDVALUE('Année PM'[Year]))

 

The fact that the lst SELECTEDVALUE works assumes you are bounded to a single year, other wise (having months in different years) we should change the approach

 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

Helpful resources

Announcements