Forum Discussion

Idonotknowthis's avatar
Idonotknowthis
New Member
1 year ago
Solved

"Calculation error in measure" when adding an HTML table in PBI

Hello, everyone! 

I'm trying to create an HTML table and add it as a column in a table visual in a report's page. I have no errors in the HTML code, the measure is created succesfully. But when adding it to the visual I get this error: 

Funny thing is I've done this before and it worked just fine. 

If you wonder why I need this html table in the visual table, I'm going to use it for a Power Automate flow. 

Here is how the measure looks like currently:

HTML table =

 "<table style='width: 800px; font family: Arial; box-shadow: 2px 2px 4 px #e0e0e0;'>

    <tr style='background-color: #f0f0f0;'>

        <th style='padding: 20px; color: black;'>Header 1</th>

        <th style='padding: 20px; color: black;'>Header 2</th>

        <th style='padding: 20px; color: black;'>Header 3</th>

        <th style='padding: 20px; color: black;'>Header 4</th>

        <th style='padding: 20px; color: black;'>Header 5</th>

    </tr>"

    &

    CALCULATE(

        CONCATENATEX(

            Table name,

            "<tr>

                <td style='padding: 20px; text-align: center;'>"& Table name[Data] &"</td>

                <td style='padding: 20px; text-align: center;'>"& Table name[Data]  &"</td>

                <td style='padding: 20px; text-align: left;'><a href='"& Table name[link name] &"' style='color: #5c49ef; text-decoration: none;'> "& Device[Name] &" </a></td>

                <td style='padding: 20px; text-align: center;'>"& Table name[Data]  &"</td>

                <td style='padding: 20px; text-align: center;'>"& Table name[Data]  &"</td>

            </tr>",

            UNICHAR(10),

            Table name[Data], ASC

        ))

        &
"</table>"

I would apreciate if you could help me resolve this issue! Thanks in advance!

  • Thanks for the input! The table was too big, so I've added a FILTER function before the CONCATENATION to use the values that I need only. That worked for me. 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Idonotknowthis 

    Here are a few suggestions to help you resolve this:

    Reduce the HTML Content: Try to minimize the HTML content to see if it resolves the issue. You can start by removing some of the inline styles or reducing the number of columns and rows.

    Check for Hidden Characters: Sometimes, hidden characters or extra spaces can cause issues. Ensure that there are no unnecessary characters in your measure.

     

     

     

     

     

     

     

     

    Best Regards,

    Jayleny

     

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

    • Idonotknowthis's avatar
      Idonotknowthis
      New Member

      Thanks for the input! The table was too big, so I've added a FILTER function before the CONCATENATION to use the values that I need only. That worked for me.