Modify Calc within Selected Value logic

Hello @mdalton2100,

Thank You for providing the reference PBIX files.

The reason why you were not able to achieve the results is because of the way you had designed your data model and created the relationship between the tables. i.e. between “Gross Margin Transactions” table and “Mapping For Flux Analysis Only” table.

Since your “Gross Margin Transactions” table is a Fact Table and “Mapping For Flux Analysis Only” table is being used as a Template Table. Why do you want to create a relationship between them?

And that too, the relationship which you had created was “Many-to-Many” with “Bi-directional Filters”. Below is the screenshot of your data model provided for the reference -

Due to this, it was not able to evaluate the correct results i.e. $70K was not getting reflected inside the “Material CoGS” criteria. Below is the screenshot provided for the reference -

Now, once you delete the “Many-to-Many Relationship” between these two tables you’ll see that it’ll start to evaluate the results correctly. Below are the screenshots of the revised data model and the final results provided for the reference -

I’m also attaching the working of the PBIX file as well as providing few of the links below pertaining to the “Many-to-Many Relationships” for the reference purposes.

Hoping you find this useful and meets your requirements that you’ve been looking for. :slightly_smiling_face:

Important Note:

Make this a thumb rule that never ever create a relationship between your Fact Table or Dimension Table with that of the Template Tables.

Fact Tables contains the information pertaining to the analytical aspects or transactional information whereas Dimension Tables are used for slicing and dicing the data.

But Template Tables have absolutely nothing to do with any of these tables they’re just the mere secondary or supporting tables in your data model which are just being used to show the information in a specified format and nothing else.

Lastly, unless and until you know the exact behaviour of the “Many-to-Many Relationships” never use it never in your data model. It’s best to create a relationship virtually within your measure using the TREATAS() function.

Thanks and Warm Regards,
Harsh

Product _ Gross Margin.pbix (1.2 MB)

2 Likes