Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi all,
I was hoping to get help with a dynamic title of month and year, like so:
This is currently made using the following two formulae:
Ideally, the formula would be able to sort the selected value alphabetically when only two months are included, and also use [QTR_NBR] if 3 months in the one quarter were selected.
Any assistance would be greatly appreciated!
Thanks,
James
Solved! Go to Solution.
Hi @JLarkin
Please try
Title - Selection =
CONCATENATEX (
VALUES ( DATE_DIM[MNTH_NAME] ),
DATE_DIM[MNTH_NAME],
" & ",
CALCULATE ( MAX ( DATE_DIM[MNTH_NUMBER] ) ), ASC
)
Title =
IF (
COUNTROWS ( VALUES ( 'DATE_DIM'[MNTH_NAME] ) ) = 3
&& COUNTROWS ( VALUES ( 'DATE_DIM'[QTR] ) ) = 1,
MAX ( 'DATE_DIM'[QTR] ),
[Title - Selection]
) & " "
& SELECTEDVALUE ( 'DATE_DIM'[YR_NBR] ) & " - Total Sales Bookings"
Hi @JLarkin
Please try
Title - Selection =
CONCATENATEX (
VALUES ( DATE_DIM[MNTH_NAME] ),
DATE_DIM[MNTH_NAME],
" & ",
CALCULATE ( MAX ( DATE_DIM[MNTH_NUMBER] ) ), ASC
)
Title =
IF (
COUNTROWS ( VALUES ( 'DATE_DIM'[MNTH_NAME] ) ) = 3
&& COUNTROWS ( VALUES ( 'DATE_DIM'[QTR] ) ) = 1,
MAX ( 'DATE_DIM'[QTR] ),
[Title - Selection]
) & " "
& SELECTEDVALUE ( 'DATE_DIM'[YR_NBR] ) & " - Total Sales Bookings"
Thanks @tamerj1 i've been scratching my head on something similar for a while, this worked perfectly.
How would i go about layering in YTD? For example, if April - August are selected then return "YTD"?
Many thanks,
Matt.
Hi @tamerj1 ,
So i'm looking to build a dynamic title that breaks down as follows:
- If singular month selected it appears as below
- If two months are selected it appears in a list as below
- If the relevant 3 months are selected for the qtr then return the financial qtr as below
All of the above works perfectly using your original solution.
The bit i'm struggling with is layering in "YTD" if all months are selected. I currently have it structured as below when all months are selected. Instead of a list of the months selected i want it to return "YTD".
Hopefully this makes more sense!
Thanks,
Matt.
Try to wrap the formula with
IF (
ISFILTERED ( 'Table'[Month] ),
'Original formula',
"YTD"
)
Hi,
Try This Dax Code Instead:
Title - Selection =
VAR __MonthOrder = LOOKUPVALUE(DATE_DIM[MNTH_NUMBER], DATE_DIM[MNTH_NAME], SELECTEDVALUE(DATE_DIM[MNTH_NAME]))
RETURN
CONCATENATEX(
VALUES(DATE_DIM[MNTH_NAME]),
DATE_DIM[MNTH_NAME],
" & ",
__MonthOrder,
ASC)
Hi @ShahabHoghooghi,
Thank you for your response but this is unfortunately not what I need. The ASC does not take into account the sort column I have on the months, and then does it by alphabetical order. I also require for the title to switch to using the column [QTR_NBR] when 3 months in the same QTR are selected:
For example, selecting the first two months should display "January & February - Total Sales..", and selecting the first three should display "Q1 - Total Sales.."
Many thanks,
James
No, If you have a look at the variable I defined, I used lookup value, then for example it lookup when the month name is March, then it gives you the month number column for that specefic selection, which is 3. It means that, this code will be sorted based on Month Number (numerical) not Month Name and will not be alphabetical.
The second concat measure you created is fine. you just need to change the first one and use month number for sorting instead of month name.
Hope it works for you.
Hi @ShahabHoghooghi.
The textbox is using the [Title - Selection] variable you defined, and it still displays as Feb & Mar & Jan, instead of Jan & Feb & Mar.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
25 | |
21 | |
19 | |
14 | |
11 |
User | Count |
---|---|
43 | |
35 | |
25 | |
22 | |
22 |