Forum Discussion

SandorTS's avatar
SandorTS
New Member
1 year ago
Solved

Card visual or measure error

I want to create and show a division, but card visual shows 'Error fetching data for this visual'. Here is my code:   Measure = VAR _aaa =     CALCULATE(         SUM('Consolidated table'[Cost])...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi SandorTS 

     

    Thanks for the reply from danextian .

     

    I created a sample data to do the test and everything shows up fine. If my sample data is different from the data structure you are using, then please provide some sample data and expected results based on the sample data so that we can help you better. How to provide sample data in the Power BI Forum - Microsoft Fabric Community Or show them as screenshots or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.

     

    My sample:

     

    Measure:

     

    Measure = 
    VAR _aaa =
        CALCULATE(
            SUM('Consolidated table'[Cost]),
            'Consolidated table'[Data Source] <> "X"
        )
    VAR _bbb =
        CALCULATE(
            SUM('Consolidated table'[Cost]),
            'Consolidated table'[Data Source] = "X"
        )
    VAR _osszeg =
        Divide(_aaa, _bbb)
    RETURN
    _osszeg

     

     

    Output:

     

    For measure, I set it to show two decimals, sometimes the default may not show decimals, then the result will show 0.

     

     

    Also, what I need to confirm with you is whether the error is in Power BI desktop or Power BI Service? What is your data source? 

     

    If it's appearing in Service, I found a couple of posts with similar error reporting for your reference:

     

    The solution to this post is to remove the semicolon from the SQL query in the Advanced Editor.

    Solved: Couldn't load the data for this visual - Microsoft Fabric Community

     

    One solution in this post is to check the permissions of the gateway.

    Solved: Re: Error fetching data for this visual - Microsoft Fabric Community

     

    Best Regards,
    Yulia Xu

     

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