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
Pete_81
Frequent Visitor

Calculate the Second To Last Date But Remove The Timestamp? (CALCULATE & FORMAT?) - CARD

I have this:

 

CalcLastWeek =
VAR GetDate =
CALCULATE( MAXX ('MyTable','MyTable'[Report Date]), ALLSELECTED('MyTable') )
RETURN
CALCULATE(
MAXX('MyTable','MyTable'[Report Date]),
FILTER(ALL('MyTable'),'MyTable'[Report Date]< GetDate)
)

 

Which does the job, but I need to remove the timestamp that is also displayed on the card.

I can't seem to find the correct place to put the FORMAT code.

 

Any help would be greatly appreciated. Thanks.

1 ACCEPTED SOLUTION
Samarth_18
Community Champion
Community Champion

Hi @Pete_81 ,

 

You can update your measure like below if you want to handle formatting in measure itself:-

CalcLastWeek =
VAR GetDate =
    CALCULATE (
        MAXX ( 'MyTable', 'MyTable'[Report Date] ),
        ALLSELECTED ( 'MyTable' )
    )
VAR result =
    CALCULATE (
        MAXX ( 'MyTable', 'MyTable'[Report Date] ),
        FILTER ( ALL ( 'MyTable' ), 'MyTable'[Report Date] < GetDate )
    )
RETURN
    FORMAT ( result, "MM/DD/YYYY" )

or you can change it explicitly from the top ribbon :

image.png

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

2 REPLIES 2
Samarth_18
Community Champion
Community Champion

Hi @Pete_81 ,

 

You can update your measure like below if you want to handle formatting in measure itself:-

CalcLastWeek =
VAR GetDate =
    CALCULATE (
        MAXX ( 'MyTable', 'MyTable'[Report Date] ),
        ALLSELECTED ( 'MyTable' )
    )
VAR result =
    CALCULATE (
        MAXX ( 'MyTable', 'MyTable'[Report Date] ),
        FILTER ( ALL ( 'MyTable' ), 'MyTable'[Report Date] < GetDate )
    )
RETURN
    FORMAT ( result, "MM/DD/YYYY" )

or you can change it explicitly from the top ribbon :

image.png

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Tanushree_Kapse
Impactful Individual
Impactful Individual

Hi @Pete_81 ,

You can simply click on the measure, in the ribbon on top, you would see a format and data type option: you can set the data type from Date-time to just date. Anf also can set the format from there.

 

Or else try this measure:

Measure= Format (Calclastweek, "dd/mm/yyyy")

 

 

Mark this as a solution if I answered your question. Kudos are always appreciated.

Thanks

 

 

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.

Top Solution Authors