Forum Discussion

Bandy's avatar
Bandy
Frequent Visitor
1 year ago
Solved

Error fetching data for this visual

Hi, 

I've a Power BI report direct query connection to SSAS Cube. I have created a measure Measure1 = DIVIDE(SUM( fact[cost]), SUM(fact[imp]))

I have kept this measure in the visual and a column from the fact table. It loads fine. As soon as I kept a visual level filter by applying Measure1 less than 10. Visual breaks.

Error - doesnt have any sepcific details

 

  • Hi Bandy,
    Thanks for the update and the detailed diagnostics.

    You are right this behaviour stems from how Power BI translates visual-level filters on measures (like [CPM] < 10) into queries for the SSAS engine. When string columns (like CampaignName) contain non-ASCII characters, this can sometimes lead to query parsing or encoding issues, particularly in MDX/DMX back-end processing.

    To workaround this issue, here are a few suggestions: Avoid using visual-level filters on calculated measures directly when dealing with non-ASCII text. Instead, incorporate the filter logic within your measure, below mentioned measure:

    Filtered CPM = IF ( [CPM] < 10, SELECTEDMEASURE() )

    and use this measure in the visual without adding a visual-level filter.

    Alternatively, replace the hardcoded threshold with a disconnected parameter table so you can control the filtering via slicer selection, without triggering internal query issues. If you are using Import mode and have control over the model, you could also pre-calculate flags like IsLowCPM in a column and filter based on that instead of a measure.

    Hope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.

    Thank you for using the Microsoft Fabric Community Forum.

11 Replies

  • v-kpoloju-msft's avatar
    v-kpoloju-msft
    Community Support

    Hi Bandy,

    Thank you for reporting this issue. Also thanks to MasonMA, FBergamaschi, for those inputs on this thread. Based on your description and the screenshot, the problem appears to stem from a limitation in SSAS Multidimensional (MD) when using visual-level filters on DAX measures (like) in a Power BI report with Direct Query mode. Measure1 < 10.

    SSAS MD does not fully support translating such filters into MDX, which causes the query to fail and return the generic “Error fetching data for this visual.”

    Recommended Workarounds:

    • Avoid using visual-level filters on the measure. Instead, use a slicer based on a disconnected table, and modify the measure to conditionally show results based on that slicer.
    • If possible, move the ratio logic into a calculated column and filter based on that.

    Unfortunately, this is a known limitation with SSAS MD and Direct Query behaviour in Power BI. Migrating to SSAS Tabular or using Import mode would offer better DAX support.

    Kindly refer to the below mentioned documentation links for better understanding:
    Analysis Services multidimensional data in Power BI Desktop - Power BI | Microsoft Learn
    Direct Query mode in Analysis Services | Microsoft Learn

    Also, this is the solved thread which might be helpful to you:
    Solved: Re: Error fetching data for this visual - Microsoft Fabric Community

    Hope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.

    Thank you for using the Microsoft Community Forum.

    • Bandy's avatar
      Bandy
      Frequent Visitor

      ‎Thanks a lot v-kpoloju-msft  for the guide and workarounds.
      I applied your first approach using a calculation group, and it worked — but the table total values are incorrect (expected total calculation behaves differently in Power BI).  

      I'll later fetch the value from a disconnected table and replace the hardcoded 10.

      Upon further testing, I noticed that the column CampaignName contains non-ASCII characters. As a test, I filtered one of the campaign names to:

      use this link to see  (unable to paste here)

      I connected SQL Server Profiler to the SSAS Cube and monitored the queries Power BI sends.

      • When there is no visual-level filter using a measure (like CPM = SUM(Cost) / SUM(Impressions) < 10), the visual displays fine.

      • But as soon as I add the measure as a filter, the visual throws an error. 

      Use this link -  for query

       

      From the SSAS Profiler, the error seems to be related to invalid characters.

      I don't understand, Why does Power BI render the visual correctly when no filter is applied, but throws an error due to invalid characters only when a measure filter is added?

      • v-kpoloju-msft's avatar
        v-kpoloju-msft
        Community Support

        Hi Bandy,
        Thanks for the update and the detailed diagnostics.

        You are right this behaviour stems from how Power BI translates visual-level filters on measures (like [CPM] < 10) into queries for the SSAS engine. When string columns (like CampaignName) contain non-ASCII characters, this can sometimes lead to query parsing or encoding issues, particularly in MDX/DMX back-end processing.

        To workaround this issue, here are a few suggestions: Avoid using visual-level filters on calculated measures directly when dealing with non-ASCII text. Instead, incorporate the filter logic within your measure, below mentioned measure:

        Filtered CPM = IF ( [CPM] < 10, SELECTEDMEASURE() )

        and use this measure in the visual without adding a visual-level filter.

        Alternatively, replace the hardcoded threshold with a disconnected parameter table so you can control the filtering via slicer selection, without triggering internal query issues. If you are using Import mode and have control over the model, you could also pre-calculate flags like IsLowCPM in a column and filter based on that instead of a measure.

        Hope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.

        Thank you for using the Microsoft Fabric Community Forum.

  • Bandy's avatar
    Bandy
    Frequent Visitor

     

    Due to sensitive data, I need to hide the Name field. 
    Here is the snip where teh measure 1 works fine until I keep the visual level filter. 

    Additional Info 
    Count of Name field values - 70,985,036
    Distinct count of name field values - 814,938