Forum Discussion

matteob's avatar
matteob
Frequent Visitor
5 years ago
Solved

manage table with entry date and exit date

Hi, I have a table with a list of material with a unique code with the relative purchase cost.

For each row there is an entry date and an exit date. I would like to be able to view a list with the material present on a specific date.

I have set up a calendar table with no relationships. I added a calculated column to the table with the material in order to filter the list later. This is what I put in the calculated column, but it doesn't work. What's wrong?

 

column =
var seldata = SELECTEDVALUE(calendario[Date])
var datacons = Query1[Consegna]
var dataarr = Query1[Carico]
return
IF((dataarr<seldata && datacons>=seldata),1,0)


thanks

  • matteob 

    Create a measure to identify the rows in which the date_in is before the minimum date selected and the out_date is after the maximun date selected using:

     

    Code In Stock = 
    VAR InDate = MIN(calendario[Date])
    Var OutDate = MAX(calendario[Date])
    RETURN 
    COUNTROWS(
        CALCULATETABLE(
                VALUES(Foglio1[code]),
                FILTER(Foglio1,
                Foglio1[date_in] <= InDate &&
                Foglio1[date_out] > OutDate)))

     

    Add this measure to the filter on the visual in the filter pane and set the value to 1.

     

    I've attached the sample PBIX file

10 Replies

  • PaulDBrown's avatar
    PaulDBrown
    Icon for Community Champion rankCommunity Champion

    matteob 

    Create a measure to identify the rows in which the date_in is before the minimum date selected and the out_date is after the maximun date selected using:

     

    Code In Stock = 
    VAR InDate = MIN(calendario[Date])
    Var OutDate = MAX(calendario[Date])
    RETURN 
    COUNTROWS(
        CALCULATETABLE(
                VALUES(Foglio1[code]),
                FILTER(Foglio1,
                Foglio1[date_in] <= InDate &&
                Foglio1[date_out] > OutDate)))

     

    Add this measure to the filter on the visual in the filter pane and set the value to 1.

     

    I've attached the sample PBIX file

  • matteob , You can not create a column with the selected value. Means you can not use slicer value in measure, you have to use it in a  measure

    • matteob's avatar
      matteob
      Frequent Visitor

      Ok thanks for the reply.

      Yes, in fact, in a "measure" I managed to make the sum of the costs with these parameters.

       

      Is there another way to view the table filtered on these dates?

      I should also see the list of material present on the date entered.

       

       

       

       

       

       

  • matteob's avatar
    matteob
    Frequent Visitor

    Is there another way to view the table filtered on these dates ?

  • v-janeyg-msft's avatar
    v-janeyg-msft
    Icon for Community Support rankCommunity Support

    Hi, matteob 

     

    You need to know that the calculated column is calculated when the data is loaded. It won't change with your choice. To filter the data, you need to change the calculated column to measure, and then put it in the filterpane.

    measure =
    VAR seldata =
        SELECTEDVALUE ( calendario[Date] )
    VAR datacons = SELECTEDVALUEQuery1[Consegna]
    VAR dataarr = SELECTEDVALUEQuery1[Carico]
    RETURN
        IF ( ( dataarr < seldata && datacons >= seldata ), 1, 0 )

    If it doesn’t solve your problem, please feel free to ask me.

     

    Best Regards

    Janey Guo

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • matteob's avatar
      matteob
      Frequent Visitor

      Thanks v-janeyg-msft,
      I tried with the measure as you said, but unfortunately the table view is not filtered.

      • v-janeyg-msft's avatar
        v-janeyg-msft
        Icon for Community Support rankCommunity Support

        matteob ,Have you put it in filter pane?

        Like this:

        Best Regards

        Janey Guo

         

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.