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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
KellyM82
New Member

Add formating to ISFILTERED VAR measure

Hi there,

 

I have a DAX measure that returns the items selected from a slicer so that I can have the selected items listed within a table and the slicer panel hidden so it takes up less space on the canvas. It works for all slicers but it's currently returning the date format as MM/DD/YYYY and I need it to show as DD/MM/YYYY. The field is set to the correct format so I'm assuming I need to add the format into my DAX but I've tried a whole host of combinations and none are working. The DAX is as follows:

=
    -- Date
    IF(
        ISFILTERED('Data Table: Population'[Date]),
        VAR items = VALUES('Data Table: Population'[Date])
        VAR itemscombined = CONCATENATEX(items, 'Data Table: Population'[Date], UNICHAR(10))
        RETURN Itemscombined & UNICHAR(10)

Any help would be appreciated.
1 ACCEPTED SOLUTION
123abc
Community Champion
Community Champion

To format the date in your DAX measure, you can use the FORMAT function. In your existing DAX measure, you can add FORMAT to change the date format from MM/DD/YYYY to DD/MM/YYYY. Here's the modified DAX:

 

=
-- Date
IF(
ISFILTERED('Data Table: Population'[Date]),
VAR items = VALUES('Data Table: Population'[Date])
VAR itemscombined = CONCATENATEX(items, FORMAT('Data Table: Population'[Date], "DD/MM/YYYY"), UNICHAR(10))
RETURN itemscombined & UNICHAR(10)
)

 

In this modified DAX, the FORMAT function is used to format the date from 'Data Table: Population'[Date] as "DD/MM/YYYY". This will ensure that the date is displayed in the desired format in your table.

Make sure to adjust the format string within the FORMAT function according to your specific requirements, such as "DD/MM/YYYY" or "DD-MM-YYYY", depending on how you want the date to be displayed.

 

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

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

View solution in original post

3 REPLIES 3
123abc
Community Champion
Community Champion

To format the date in your DAX measure, you can use the FORMAT function. In your existing DAX measure, you can add FORMAT to change the date format from MM/DD/YYYY to DD/MM/YYYY. Here's the modified DAX:

 

=
-- Date
IF(
ISFILTERED('Data Table: Population'[Date]),
VAR items = VALUES('Data Table: Population'[Date])
VAR itemscombined = CONCATENATEX(items, FORMAT('Data Table: Population'[Date], "DD/MM/YYYY"), UNICHAR(10))
RETURN itemscombined & UNICHAR(10)
)

 

In this modified DAX, the FORMAT function is used to format the date from 'Data Table: Population'[Date] as "DD/MM/YYYY". This will ensure that the date is displayed in the desired format in your table.

Make sure to adjust the format string within the FORMAT function according to your specific requirements, such as "DD/MM/YYYY" or "DD-MM-YYYY", depending on how you want the date to be displayed.

 

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

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

That's perfect, thank you so much 😊

123abc
Community Champion
Community Champion

You are always wellcome.😊

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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