Forum Discussion

tom-lenzmeier's avatar
tom-lenzmeier
Icon for Helper II rankHelper II
5 months ago
Solved

Dynamic Formatting Error

In my values column in an unpivoted table, I am trying to apply dynamc formatting to amounts and dates. Prior to the unpivot action, I converted the date column to decimal and the amount column is de...
  • Natarajan_M's avatar
    5 months ago

    Hi tom-lenzmeier , I just modified the DAX formula you were using and obtained the following result. Can you let me know if this is what you are looking for?

    The issue with the sum on the date was causing an overflow error, so I took the maximum value and added it to the date to resolve the problem.



    Display Value Fixed = 
    VAR _AttrType = SELECTEDVALUE(UP_PRD_Agreements[Attribute])
    VAR _Raw      = SUM(UP_PRD_Agreements[Value])
    VAR _RawMax   = MAX(UP_PRD_Agreements[Value])
    
    RETURN
    SWITCH(
        _AttrType,
    
        "EffectiveDate",
            FORMAT(
                DATE(1899, 12, 30) + INT(_RawMax),
                "MM/dd/yyyy"
            ),
    
        "Current Price",
            FORMAT(_Raw, "$#,##0"),
    
        "Current Price Valid From",
            FORMAT(
                DATE(1899, 12, 30) + INT(_RawMax),
                "MM/dd/yyyy"
            ),
    
        FORMAT(_Raw, "0")
    )


    dax :


    Fixed dax :

    Sample file :
    Dynamic Formatting.pbix

    Thanks,
    If this response was helpful in any way, I’d gladly accept a kudo.
    Please mark it as the correct solution. It helps other community members find their way faster