Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
SR1122
Frequent Visitor

I want to exclude zero billers from my analysis only when they have no revenue in particular month

I have a requirement where the customer needs to be excluded from the analysis if it has zero bills in that particular month.

I am working with one table which contains all the transactions.


EG.

DateCustomer IDRevenue per transactionTotal Products
23/01/20222905
24/01/2022291.46
24/01/202229 2.46
25/01/202229 510
25/01/202228010
23/01/202228016
21/01/202228017
16/01/202228021
23/02/202229032
24/02/2022291.4123
24/02/202229 2.4112
25/02/202229 5312
25/02/2022280231
23/02/20222810033
21/02/2022280112
16/02/2022280213


As you can see in the example below I want to ignore the count of company 29 in Jan and ignore the product counts.
But i want to count the company 29 next month as it has revenue and want to count the product.

 

I have tried the following but the problem is in Feb 2022 it will ignore the products which has zero revenue. 

Customer count = CALCULATE(DISTINCTCOUNT(Sales[companyid]),Sales[amount]<>0)

 

 

1 ACCEPTED SOLUTION

Hi @SR1122 ,

 

According to your description, I made a sample with more years and months. Please follow these steps.

Create two columns to return the years and months of the "DATE" column.

month of date =
MONTH ( 'Table (2)'[Date] )
year of date =
YEAR ( 'Table (2)'[Date] )

Then create a column to return the expected result.

result =
IF (
    COUNTROWS (
        FILTER (
            'Table (2)',
            'Table (2)'[month of date] = EARLIER ( 'Table (2)'[month of date] )
                && 'Table (2)'[year of date] = EARLIER ( 'Table (2)'[year of date] )
                && 'Table (2)'[Customer ID] = EARLIER ( 'Table (2)'[Customer ID] )
                && 'Table (2)'[Revenue per transaction] <> 0
        )
    ) > 0,
    CALCULATE ( DISTINCTCOUNT ( 'Table (2)'[Customer ID] ) )
)

Final output:

vxiaosunmsft_0-1667358883709.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ xiaosun

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

View solution in original post

3 REPLIES 3
v-xiaosun-msft
Community Support
Community Support

Hi @SR1122 ,

 

According to your description, it seems that you want to ignore the products which has zero revenue in Jan, but do not want to ignore the products which has zero revenue in Feb.

Please create a column.

Customer count =
IF (
    MONTH ( 'Table'[Date] ) = 1,
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Customer ID] ),
        'Table'[Revenue per transaction] <> 0
    ),
    IF (
        MONTH ( 'Table'[Date] ) = 2,
        CALCULATE ( DISTINCTCOUNT ( 'Table'[Customer ID] ) )
    )
)

Final output:

vxiaosunmsft_0-1667292186058.png

If the result is not what you need, please describe your needs more clearly and you'd better show us how your expected output looks like.

 

Best Regards,
Community Support Team _ xiaosun

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

 

Thanks for the answer, this was very useful.

 

Basically, i want to apply this logic not just for Jan and Feb.

 

The data set I have contains multiple years and this need to be applied every month to every customer.

 

The requirement is if the customer has revenue count all the products and if the customer doesn't have any revenue ignore all the products count. 

 

 

Hi @SR1122 ,

 

According to your description, I made a sample with more years and months. Please follow these steps.

Create two columns to return the years and months of the "DATE" column.

month of date =
MONTH ( 'Table (2)'[Date] )
year of date =
YEAR ( 'Table (2)'[Date] )

Then create a column to return the expected result.

result =
IF (
    COUNTROWS (
        FILTER (
            'Table (2)',
            'Table (2)'[month of date] = EARLIER ( 'Table (2)'[month of date] )
                && 'Table (2)'[year of date] = EARLIER ( 'Table (2)'[year of date] )
                && 'Table (2)'[Customer ID] = EARLIER ( 'Table (2)'[Customer ID] )
                && 'Table (2)'[Revenue per transaction] <> 0
        )
    ) > 0,
    CALCULATE ( DISTINCTCOUNT ( 'Table (2)'[Customer ID] ) )
)

Final output:

vxiaosunmsft_0-1667358883709.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ xiaosun

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.