Forum Discussion

ArchStanton's avatar
ArchStanton
Power Participant
2 years ago
Solved

Cannot remove decimal places

Hi,

 

This is driving me mad, hope someone can help!

The code below defaults the Average Months to 2 decimal places - I don't want any decimals.

 

Case Length (Adj) Mths = 
IF (
    'Cases'[statecode] = "Active",
    DATEDIFF (
        IF (
            ISBLANK ( 'Cases'[legacycasecreationdate] ),
            'Cases'[Created On],
            'Cases'[legacycasecreationdate]
        ),
        NOW (),
        MONTH
    ),
    DATEDIFF (
        IF (
            ISBLANK ( 'Cases'[legacycasecreationdate] ),
            'Cases'[Created On],
            'Cases'[legacycasecreationdate]
        ),
        'Cases'[Resolution Date],
        MONTH
    )
)

 

 

I have tried so many solutions and none work.

10 Replies

  • PijushRoy's avatar
    PijushRoy
    Community Champion

    Hi ArchStanton 

    Please use a measure 

     

    Measure = FORMAT([YourMeasure],"##")


    Let me know if that works for you

     


    If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the LIKE 👍 button if this comment helps you.

    Thanks
    Pijush
    Linkedin

    • ArchStanton's avatar
      ArchStanton
      Power Participant

      Hi, I've responded to Daniel above who proposed the same solution. It does not work as I am summarising the calaculated column by 'Averaging'.

       

      FORMAT breaks the code and I do not have the option to see a Summarised value anymore only Counts

      • PijushRoy's avatar
        PijushRoy
        Community Champion

        Hi ArchStanton 

        Dont change your existing measure
        Create a another measure use 

        Measure = FORMAT([Case Length (Adj) Mths],"##")

         

        If your requirement is solved, please mark THIS ANSWER as SOLUTION

         

      • ArchStanton's avatar
        ArchStanton
        Power Participant

        Thanks Daniel, I managed to get the answer from the other helper on this thread, I was dealing with a calculated column not a Measure.

        Thank you for helping anyway.

  • Daniel29195's avatar
    Daniel29195
    Community Champion

    ArchStanton 

    use format (  your_measure_code , "##")

     

    let me know if this works .

     

     

     

    If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
    It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

    • ArchStanton's avatar
      ArchStanton
      Power Participant

      Hi,

       

      Using FORMAT breaks the code and my Average average disappears: 

       

       

       

      Case Length (Adj) Mths = FORMAT(
      IF (
          'Cases'[statecode] = "Active",
          DATEDIFF (
              IF (
                  ISBLANK ( 'Cases'[legacycasecreationdate] ),
                  'Cases'[Created On],
                  'Cases'[legacycasecreationdate]
              ),
              NOW (),
              MONTH
          ),
          DATEDIFF (
              IF (
                  ISBLANK ( 'Cases'[legacycasecreationdate] ),
                  'Cases'[Created On],
                  'Cases'[legacycasecreationdate]
              ),
              'Cases'[Resolution Date],
              MONTH
          )
      ),"##")