Forum Discussion

GavinH's avatar
GavinH
Frequent Visitor
2 years ago

Measure error caused by calculated column

See additional information added and link to .pbix file in later post.

 

I am having problems with a measure and calculated column that seem to be interacting with one another in unexpected ways, producing inaccurate results. I have never seen this type of behaviour before and am unsure what is causing it.

 

The measure calculates percentage market share by institution and looks like this: 

 

Person share by institution = 

DIVIDE([Person count], CALCULATE([Person count], ALL(MarketData[Institution], MarketData[Institution (groups)], MarketData[Division])), BLANK())
NOTE: "Person count" is a simple sum of a numeric column. 
 
I am using this measure in a matrix table with Institution in rows and fiscal year in columns. The fiscal year column is a calculated column based on the following:
 
Fiscal Yr =
var CurrentCycle = MarketData[Cycle]
var CurrentTerm = MarketData[TermNumber]
var RevisedYear = IF(CurrentTerm=3, CurrentCycle+1, CurrentCycle)
var FollowingYear = RIGHT(FORMAT(RevisedYear+1, "General Number"), 2)
return
FORMAT(RevisedYear, "General Number")&"-"&FollowingYear
 
Everything seems to work fine initially. However, if I do two things - 1) filter out one or more fiscal year values, and 2) include a filter on another column and select more than one filter value - the percentage calculation acts strangely - see below: 
 
 

 

Note the odd percentages for the individual rows that add up to more than 100%. It ought to look like this: 

 

The only change I made here was to swap out the Fiscal Year calculated column that I created using DAX for an identical column that I created using Power Query. The fiscal year values themselves are exactly the same. 

 
Can anyone help me figure out what exactly is going on here? I have never seen anything like this before and could use some guidance. 
 
Thanks!
 
 
 
 
 

4 Replies

  • Hi GavinH ,

     

    That's interesting. I need more info to locate the problem, can you provide the pbix file?

    • GavinH's avatar
      GavinH
      Frequent Visitor

      Unfortunately, I do not appear to have the ability to attach a file in this forum. Not sure why that would be. 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi GavinH ,

         

        Thanks for the reply from xifeng_L .

         

        As he said, screenshots and syntax alone can't help you much.

         

        You can upload the pbix file to a website like OneDrive, Google Drive, Dropbox, and then share the URL.

         

        Remember not to log in to your own account in Power BI Desktop when uploading the pbix file.

         

        If you have any other questions, please feel free to contact me.

         

        Best Regards,
        Yang
        Community Support Team

         

        If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
        If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!