Forum Discussion

Danbo45689's avatar
Danbo45689
Regular Visitor
1 year ago
Solved

Date based conditional formatting in a Power BI Table

Hi,   I'm relatively new to Power BI and finding my feet slowly.   I'm wanting to replicate something that is possible in Excel, and am unsure how to go about doing this in Power BI   I have a ...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Danbo45689 ,

     

    In PowerBI Desktop, we can get the data from that excel file, but we can't retain the original formatting.


    I have created simple data.

     

    The steps to do this are as follows:

    1. Create a measure, and you can modify it to suit your needs:

    Color = 
    VAR _day=DATEDIFF(MAX('Table'[Date]),TODAY(),DAY)
    RETURN
    SWITCH(TRUE(),_day>0&&_day<=30,1,_day>30,2)

     

    2. Conditional formatting of the table visual:

    Use the value of the measure you just created as the standard:

    3.Result:

     

    Best Regards,
    Zhu

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.