Forum Discussion

rmolinajr's avatar
rmolinajr
Frequent Visitor
9 years ago
Solved

Records that do not exist in the table

Hi, 

 

I'm having trouble creating a report and was wondering if anyone can help me.

 

The report needs to do the following:

 

Table DataBase:

 

NameSalaryPayday
Robert100005-09-2017
Robert300007-07-2017
Robert200008-10-2017
Lilian300007-07-2017
Lilian50008-10-2017
Lilian006-10-2017
Kelly300005-02-2017
Kelly50006-20-2017
Kelly50007-02-2017
Kelly5008-02-2017

 

There is this sample information and when I load in power bi, I want to create a matrix table and the result would look like this:

Capturar

 

I did not select anything in the filter and then all the reports appear.

But what I need to do, everyone with zero and zero would need to disappear.

 

Choosing the filter, bringing the month 6 to Lilian parace again, because it does not have more months with 0.

 

 

I made a calculation, example:

 

.Sum_Salary = SUM(Tabela1[Salary]) 

.Min_Salary = MINX(ALLSELECTED(Tabela1[Month]); [.Sum_Salary])

 

Placing the .Min_Salary measurement in "Visual level filters" will remove the expected results.

 

See the image below:

Capturar

 

This result that vanished Lilian was because I put the measure .Min_Salary> 0 in the filtering.

 

Capturar1

 

But the problem is Robert who has not disappeared, he has the value of the month 6 null, because it has no value in that month, so it should disappear, that I'm in trouble, I can not remove this line.

 

Choosing the filter, bringing the month 6 to Lilian parace again, because it does not have more months with 0.

 

Capturar3

 

Who can help me, thank you.

  • Hi rmolinajr,

     

    The easiest way may be adding the missing values of some months. When I added the blank values to the table, the result was easy to filter.

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Maybe we could create a new table with all the month data.

    Test =
    ADDCOLUMNS (
        CROSSJOIN ( VALUES ( 'Tabela1'[Name] ), VALUES ( 'Tabela1'[Month] ) ),
        "paydate", LOOKUPVALUE ( Tabela1[Payday], Tabela1[Month], [Month], Tabela1[Name], [Name] ),
        "newsalary", IF (
            ISBLANK (
                LOOKUPVALUE ( Tabela1[Salary], Tabela1[Name], [Name], Tabela1[Month], [Month] )
            ),
            0,
            LOOKUPVALUE ( Tabela1[Salary], Tabela1[Name], [Name], Tabela1[Month], [Month] )
        )
    )

    Then it's easy to filter data.

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Best Regards!

    Dale

2 Replies

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Microsoft Employee

    Hi rmolinajr,

     

    The easiest way may be adding the missing values of some months. When I added the blank values to the table, the result was easy to filter.

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Maybe we could create a new table with all the month data.

    Test =
    ADDCOLUMNS (
        CROSSJOIN ( VALUES ( 'Tabela1'[Name] ), VALUES ( 'Tabela1'[Month] ) ),
        "paydate", LOOKUPVALUE ( Tabela1[Payday], Tabela1[Month], [Month], Tabela1[Name], [Name] ),
        "newsalary", IF (
            ISBLANK (
                LOOKUPVALUE ( Tabela1[Salary], Tabela1[Name], [Name], Tabela1[Month], [Month] )
            ),
            0,
            LOOKUPVALUE ( Tabela1[Salary], Tabela1[Name], [Name], Tabela1[Month], [Month] )
        )
    )

    Then it's easy to filter data.

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Best Regards!

    Dale

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Microsoft Employee

    Hi rmolinajr,

     

    Could you please mark the proper answer as solution or share the answer if it's convenient for you? That will be a help to the others.

     

    Best Regards!
    Dale