Forum Discussion

JimmyBos's avatar
JimmyBos
Helper II
1 year ago
Solved

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

  • PijushRoy's avatar
    PijushRoy
    Community Champion

    Hi JimmyBos 
    Please check the PBIX if this works for you (I have created a relationship because without relationship this will not work)
    Else please explain the issue with screenshot

    • JimmyBos's avatar
      JimmyBos
      Helper 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.

       

       

       

  • v-karpurapud's avatar
    v-karpurapud
    Community 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!