Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Calculated colum

Hi all,

 

I have a question for this DB:

https://www.dropbox.com/s/m8hywr41rn6neq8/example.xlsx?dl=0

 

I wold have a table:

- grouped by Rimorchio: a list of all the contents

- Grouped by Trasportatore

- 3 fileds: Check in, check out, tot

1) checkin= the tot of the nr of Checkin from the field "senza titolo", for each index of "Rimorchio"

2) checkout = the tot of the nr of Checkout from the field "senza titolo", for each index of "Rimorchio"

3) tot= the difference between checkout and checkin

 

Do u have any idea to solve it?

Thanks for your help

  • Anonymous 

    Hope I understood your request correctly.

    create a table

    Table = ADDCOLUMNS( SUMMARIZE('Foglio1','Foglio1'[RIMORCHIO],"checkin",CALCULATE(countrows(Foglio1),FILTER('Foglio1',Foglio1[Senza Titolo]="CHECKIN")),"checkout",CALCULATE(countrows(Foglio1),FILTER('Foglio1',Foglio1[Senza Titolo]="CHECKOUT"))),"tot",[checkout]-[checkin])

4 Replies

  • VijayP's avatar
    VijayP
    Community Champion

    Anonymous 

    If I have understood your question , please let me know do you want this information shown in the belwo pic?

    Vijay Perepa

     

  • Anonymous 

    Hope I understood your request correctly.

    create a table

    Table = ADDCOLUMNS( SUMMARIZE('Foglio1','Foglio1'[RIMORCHIO],"checkin",CALCULATE(countrows(Foglio1),FILTER('Foglio1',Foglio1[Senza Titolo]="CHECKIN")),"checkout",CALCULATE(countrows(Foglio1),FILTER('Foglio1',Foglio1[Senza Titolo]="CHECKOUT"))),"tot",[checkout]-[checkin])

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Ryan

       

      it works!

      thanks a lot

      a last question:

      how can I had a column to have the greater date relative at the check in?

      • ryan_mayu's avatar
        ryan_mayu
        Super User

        Anonymous 

        do you want to add the latest checkin date to the new table?

        Table = ADDCOLUMNS( SUMMARIZE('Foglio1','Foglio1'[RIMORCHIO],"checkin",CALCULATE(countrows(Foglio1),FILTER('Foglio1',Foglio1[Senza Titolo]="CHECKIN")),"checkout",CALCULATE(countrows(Foglio1),FILTER('Foglio1',Foglio1[Senza Titolo]="CHECKOUT")),"maxcheckindate",CALCULATE(max('Foglio1'[Data della registrazione]),ALLEXCEPT('Foglio1',Foglio1[RIMORCHIO]))),"tot",[checkout]-[checkin])