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
Bond700
Frequent Visitor

How to build a matrix table in power bi

Hi All, could anybody help me?
I have 2 columns: copmany_id and date_issued. 
I'm trying to create a table that calculates count of departed companies every month. Departed company every month - count of unique copmanies that dont have purchases more than 180 days.
Main detail: copmany can be departed repeatedly
Table example that i need to show:

                                    January 2018   February 2018   March 2018  etc

departed_copmanies

 

data example:

company_id    date_issued

323                 05.01.2018

323                 31.12.2017

149                 31.12.2017

etc                  etc

 

 

1 ACCEPTED SOLUTION
v-lid-msft
Community Support
Community Support

Hi @Bond700 ,

 

How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
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

4 REPLIES 4
v-lid-msft
Community Support
Community Support

Hi @Bond700 ,

 

How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-lid-msft
Community Support
Community Support

Hi @Bond700 ,

 

We can create a calculated table to meet your requirement:

 

Table2 = 
ADDCOLUMNS (
    FILTER (
        CALENDAR ( MIN ( 'Table'[date_issued] ), MAX ( 'Table'[date_issued] ) + 211 ),
        DAY ( [Date] ) = 1
    ),
    "Count", COUNTROWS (
        DISTINCT (
            SELECTCOLUMNS (
                FILTER (
                    FILTER ( 'Table', 'Table'[date_issued] < [Date] - 180 ),
                    NOT CONTAINS (
                        FILTER (
                            'Table',
                            'Table'[date_issued] < [Date]
                                && 'Table'[date_issued] >= [Date] - 180
                        ),
                        'Table'[company_id], [company_id]
                    )
                ),
                "id", [company_id]
            )
        )
    )
)

25.PNG

 

If it doesn't meet your requirement, Please show the exact expected result based on the Tables that you have shared.


BTW, pbix as attached.

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
kentyler
Solution Sage
Solution Sage

If you query you data so that you have 1 record for the last date for each company then a calculated column like this will give you a 1 or a 0 depending on whether the company is "departed". Then it should be easy to count by month how many companies departed by just adding up the departed column
departed.png





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Company can departe more than 1 times.
Company         Date issued          departed

a                       1 january 2017          0

a                       2 january 2017          0
a                       1 january 2018          1
a                       1 january 2019          1


Condition for departing: lt passed more than 180 days from the date_issued and copmany dont have other date_issued this period

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.