Forum Discussion

nalyons1's avatar
nalyons1
Regular Visitor
5 years ago

Some measures are breaking after 2nd incremental refresh

Hi everyone,

 

This is my first time asking a question here and I'm a newbie so please bare with me.   

 

I have a report hosted in Power BI service and have setup incremental refresh.  The incremental refresh seems to work fine, all of my data is being refreshed and updated with new data.  The problem is that certain measures are calculating incorrectly, not after the first time I run incremental refresh, but after the 2nd time.  The measures calculate percent change for daily stock price data over varying time frames.  So I have measures calculating percent change for 1 day, 1 wk, 1 month, 3 months, 6 months and 12 months.  What's weird is that the 12 months measure continues to calculate correctly while some of the others just return -100%.  Also, the measure continues to calculate correctly for some stocks, but not others.  The measures calculate correctly when I refresh in Power BI Desktop.  All the measures are the exact same the only difference being the number I'm subtracting from the Index to get the previous price for the previousPrice variable.  Here is the measure I'm using. . . 

 

ETFdaily%Return =
VAR LastPrice =
     CALCULATE (
          VALUES ( etfprices[close] ),
          FILTER ( etfprices, etfprices[date] = MAX ( etfprices[date]) ))
VAR previousPrice =
     CALCULATE (
          VALUES ( etfprices[close] ),
          FILTER ( etfprices, etfprices[Index] = MAX ( etfprices[Index] )-1 ))
RETURN
     DIVIDE(LastPrice, previousPrice)-1
 
Below is a screenshot of the report after refreshing twice in Power BI service.  I am using cards to visualize the measure filtered by the individual stock that I want display.  
 
Any help is greatly appreciated and thanks in advance!!!
 

7 Replies

  • Here's what you need to remember about incremental refresh.  Every time you make a structural/meta data change to your report (doesn't even have to be a change for the data source that you have defined the incremental refresh for) the Power BI service will do a full refresh, and will create all the partitions according to your "keep" specifications.

    Only starting with the second refresh will it actually run an incremental refresh, touching only the partitions that you have specified in the "update"  timeframe.

     

    You need to provide more details about your incremental refresh setup (especially if you chose to enable data change checks),  but maybe this explanation will already give you the reason why you see that behaviour.

    • nalyons1's avatar
      nalyons1
      Regular Visitor

      Hi lbendlin,

       

      I really appreciate you taking the time to help me.  You're first response definitley cleared up a few things for me.  I went ahead and tried deselecting the "enable data change checks", re-published and initiated incremental refresh - and got more or less the same results.  I'm not exactly sure what you mean by "Every time you make a structural/meta data change to your report (doesn't even have to be a change for the data source that you have defined the incremental refresh for) the Power BI service will do a full refresh, and will create all the partitions according to your "keep" specifications."  Could you clarify a bit more?  The etfprices, rvol30 and impliedVol tables are updated daily and all have the same incremental refresh configuration as below.  Below are screenshots of my incremental refresh configuration.  Let me know if there is something off in there, where else I might be going wrong, or if there is anything else I could provide to make it easier for you to understand the issue.   

       

      Thanks so much once again for your help!!!

       

      My parameters:

      RangeStart ParameterRangeEnd Parameter

       

      My custom filter on the etfprices table "date" column:

       

      My incremental refresh configuration for the etfprices table:

  • The values of the RangeStart and RangeEnd parameters in Power Query are not relevant for the incremental refresh (they are only useful to limit the amount of data the developer has to work with in Power BI Desktop.

     

    What _is_ important is that these two parameters are used as filters in your respective Power Query code. One of them has to be inclusive, the other exclusive.

     

    Maybe you can verify that your Power Query code satisfies these requeirements.

    • nalyons1's avatar
      nalyons1
      Regular Visitor

      I see.  I believe that the Power Query does satisfy those requirements.  Below is a screenshot of the M code for the custom filter on the "date" column of the etfprices table.  Is this what you're referring to?  

       

  • yes but you want to move that filter up as much as possible. No point in doing transformations to rows that you then throw away.

     

    Are you familiar with partitions and how to check them?

    • nalyons1's avatar
      nalyons1
      Regular Visitor

      I'll try putting the custom date filter up as high as possible in the Query and see if that helps.  

       

      I am not familiar with partitions and how to check them.  I will look into that, try a few things and report back.  

       

      Thanks again this is a huge help!

       

  • v-xulin-mstf's avatar
    v-xulin-mstf
    Icon for Community Support rankCommunity Support

    Hi nalyons1,

     

    Is you issue solved?

    If the issue is solved, could you share the final solution and make it answered?

    So that it can help others.

     

    Best Regards,

    Link