Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Data went missing after 1 add a column

Hi All,

 

I had a report that consists on 3 years data. I wanted to see if the same instruments has repair coming back each year for testing. I convert it to 3 table of each year. I setup the relation via serial no. I put in the serial and 1st year, the data will appear. I replace 1st year with 2nd year and the data will appear. However, once I put 1st and 2nd year data together, the data will go missing and I don't know why. Any help are welcome!

2 Replies

  • Anonymous , Why do you need three tables? with the same table retained customer(you need a separate year table)  approach in these blogs can work

     

    //Date/Year table

    This Year = CALCULATE(Count('Table'[instrument]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
    Last Year = CALCULATE(Count('Table'[instrument]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))

     

    Countx(values('Table'[instrument]), if( not(isblank[this year])) && not(isblank[last year])) , [instrument], blank())

     

    refer if needed

     

    Customer Retention Part 1:
    https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-1-Month-on-Month-Retention/ba-p/1361529
    Customer Retention Part 2: Period over Period Retention :https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-2-Period-over-Period-Retention/ba-p/1377458

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    I guess it should be a referential integrity issue. This is a constraint between two related tables. For two tables to establish a relationship, the foreign key value for each record in the dimension table must exist in the primary table. In short, each row of the fact table must have a corresponding record in the dimension table. 

     

    When your serial number represents the time of the first year, there will be no value matching it in the second year, so a blank value will be automatically filled in this row, that's why it doesn't seem to appear.

    Attach the PBIX file for reference. Hope it helps.

     

    If this doesn't work for you, please consider sharing more details about it. And it would be great if there was a sample file without any sensitive information here.

     

    It makes it easier to give you a solution.

    1. Sample (dummy dataset) data as text, use the table tool in the editing bar.
    2. Expected output from sample data.
    3. Explanation in words of how to get from 1. to 2.

     

    Best Regards,
    Community Support Team_Gao

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data