Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
SandorTS
New Member

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]),
        'Consolidated table'[Data Source] <> "X"
    )
VAR _bbb =
    CALCULATE(
        SUM('Consolidated table'[Cost]),
        'Consolidated table'[Data Source] = "X"
    )
VAR _osszeg =
    Divide(VALUE(_aaa), VALUE(_bbb))
RETURN
_osszeg
If I return _aaa or _bbb, the card shows 44k and 332k respectively (so its numeric and visual shows it, no error).
No applied filters on the page or on the visual, no slicer sync active from other pages.
What's the problem? Thanks.

EDIT: If I replace the code for _aaa or _bbb to be 1, then osszeg shows the correct values.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

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:

vxuxinyimsft_0-1734935607229.png

 

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.

vxuxinyimsft_2-1734935830717.png

 

vxuxinyimsft_1-1734935677949.png

 

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.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

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:

vxuxinyimsft_0-1734935607229.png

 

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.

vxuxinyimsft_2-1734935830717.png

 

vxuxinyimsft_1-1734935677949.png

 

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.

danextian
Super User
Super User

Why the need to use VALUE() when the results of the first two variables are already numeric?





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

I have tried to debug it before I checked _aaa and _bbb value. You are right, VALUE() isn't needed.
(Still not working of course)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.