cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Formatting a date in a measure (DAX)

This should be simple but can't see how to format a date in a measure.  This measure works fine except it give me a date/time format. And all I want is a MM/DD/YYYY format:

 

Right now it is showing: Between 2020/05/30 12:09:42 AM

I want it to show:  Between 5/30/2020

 

 

"Between "&
(CALCULATE(AVERAGEX(prd_f_GW_Stats,prd_f_GW_Stats[TubeUsage1]),FILTER(prd_f_GW_Stats,prd_f_GW_Stats[LRFlag]="NLR"))-
CALCULATE(AVERAGEX(prd_f_GW_Stats,prd_f_GW_Stats[TubeUsage1]),FILTER(prd_f_GW_Stats,prd_f_GW_Stats[LRFlag]="LR")))/
CALCULATE(AVERAGEX(prd_f_GW_Stats,prd_f_GW_Stats[Burn Rate]),FILTER(prd_f_GW_Stats,prd_f_GW_Stats[LRFlag]="LR"))
+
Today()

1 ACCEPTED SOLUTION

Works for me...

 

0.JPG

 

Try...

Measure =
"Between "
    & FORMAT (
        (
            CALCULATE (
                AVERAGEX ( prd_f_GW_Stats, prd_f_GW_Stats[TubeUsage1] ),
                FILTER ( prd_f_GW_Stats, prd_f_GW_Stats[LRFlag] = "NLR" )
            )
                - CALCULATE (
                    AVERAGEX ( prd_f_GW_Stats, prd_f_GW_Stats[TubeUsage1] ),
                    FILTER ( prd_f_GW_Stats, prd_f_GW_Stats[LRFlag] = "LR" )
                )
        )
            / CALCULATE (
                AVERAGEX ( prd_f_GW_Stats, prd_f_GW_Stats[Burn Rate] ),
                FILTER ( prd_f_GW_Stats, prd_f_GW_Stats[LRFlag] = "LR" )
            )
            + TODAY (),
        "M/d/yyyy"
    )

View solution in original post

7 REPLIES 7
Chihiro
Solution Sage
Solution Sage

Instead of applying format in the measure formula, you could apply format in model.

 

With measure highlighted.

 

Go to "Modeling" tab, and use "Format:" drop down. Apply formatting of your choice.0.JPG

aanyoti
Frequent Visitor

This worked for me, thanks!

Anonymous
Not applicable

That doesn't work because this measure is part text and part date

Ah I missed that part. Then nest the date portion in FORMAT()

Ex: FORMAT(TODAY(),"M/d/yyyy")

Anonymous
Not applicable

I tried that but I got an error

Works for me...

 

0.JPG

 

Try...

Measure =
"Between "
    & FORMAT (
        (
            CALCULATE (
                AVERAGEX ( prd_f_GW_Stats, prd_f_GW_Stats[TubeUsage1] ),
                FILTER ( prd_f_GW_Stats, prd_f_GW_Stats[LRFlag] = "NLR" )
            )
                - CALCULATE (
                    AVERAGEX ( prd_f_GW_Stats, prd_f_GW_Stats[TubeUsage1] ),
                    FILTER ( prd_f_GW_Stats, prd_f_GW_Stats[LRFlag] = "LR" )
                )
        )
            / CALCULATE (
                AVERAGEX ( prd_f_GW_Stats, prd_f_GW_Stats[Burn Rate] ),
                FILTER ( prd_f_GW_Stats, prd_f_GW_Stats[LRFlag] = "LR" )
            )
            + TODAY (),
        "M/d/yyyy"
    )

View solution in original post

Anonymous
Not applicable

Yep got it to work now! thanks.

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Get Ready for Power BI Dev Camp

Power BI Dev Camp - June 24th

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors