Forum Discussion
Selectedvalue showing blank
Hello All,
In my PBI file i am trying to retrieve the stock amount (no relation in place) but for some reason all results are showing blank. I have red many solutions online, but cannot seem to get them working for me.
The fomula to retrieve the Stock amount: StockQTY_Correct = SELECTEDVALUE(InkoopArtikelenStockqty[StockQty])
My file: https://drive.google.com/file/d/17T9EoilVB-ltovdhcRB_J8GH1PUL4pHg/view?usp=sharing
Hope anyone can help me out!
Hi JimmyBos
Thank you for reaching out to the Microsoft Fabric Community Forum. Also, thank you PijushRoy for your helpful response.It appears that a calculated column rather than a measure has been created using SELECTEDVALUE(...) to retrieve [StockQty] from the InkoopArtikelenStockqty table. Calculated columns are evaluated row-by-row during data model processing, and when they depend on relationships or other calculated columns (such as [Kostprijs]), they can inadvertently introduce circular dependencies.
To avoid this, consider using a measure instead, as measures are evaluated at query time and are better suited for dynamic calculations involving context-sensitive functions like SELECTEDVALUE.
DAX
StockQTY_Correct = CALCULATE( SELECTEDVALUE(InkoopArtikelenStockqty[StockQty]), TREATAS(VALUES(POStuklijst[Z1 Artikel]), InkoopArtikelenStockqty[ItemCode]) )If this response resolves your query, kindly mark it as Accepted Solution to help other community members. A Kudos is also appreciated if you found the response helpful.
Thank You!
6 Replies
- JimmyBosHelper II
Hello PijushRoy , thanks for checking the file. Right now, the way you changed it there are values showing which is good. The file however was designed so i am able to select a project (right top, for example I2400334) and see all parts (Z1 Artikel) for that project.
The way it should look:
The way it looks now:
The way you changed it, all parts are the same, not to mention they all show a different 'stockQTY'. The StockQTY should be the same for each identical partnumber.
- JimmyBosHelper II
PijushRoy , So i changed the relation many to one, this solved the problem and everything seems to be working. When i tried implementing this solution to an identical file, an error arose as soon as i tried creating the relation.
There is a circular independency detected: POStuklijst[Kostprijs] , POStuklijst[StockQTY] , POStuklijst[Kostprijs].
Any idea how to solve this one? Below the 'identical' file.
https://drive.google.com/file/d/1s6oC2Xu5kBxW4CMll8sr5Hnc9sysf1jG/view?usp=drive_link
- v-karpurapudCommunity Support
Hi JimmyBos
Thank you for reaching out to the Microsoft Fabric Community Forum. Also, thank you PijushRoy for your helpful response.It appears that a calculated column rather than a measure has been created using SELECTEDVALUE(...) to retrieve [StockQty] from the InkoopArtikelenStockqty table. Calculated columns are evaluated row-by-row during data model processing, and when they depend on relationships or other calculated columns (such as [Kostprijs]), they can inadvertently introduce circular dependencies.
To avoid this, consider using a measure instead, as measures are evaluated at query time and are better suited for dynamic calculations involving context-sensitive functions like SELECTEDVALUE.
DAX
StockQTY_Correct = CALCULATE( SELECTEDVALUE(InkoopArtikelenStockqty[StockQty]), TREATAS(VALUES(POStuklijst[Z1 Artikel]), InkoopArtikelenStockqty[ItemCode]) )If this response resolves your query, kindly mark it as Accepted Solution to help other community members. A Kudos is also appreciated if you found the response helpful.
Thank You!