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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Sohan
Helper III
Helper III

Active user through order date

I want to check if a user is active, by checking if they have had an order in the past 30 days. Right now, I have the following table "Orders"

 

Invoice dateUserIDRevenue
12-10-20221€100
09-02-20222€140
28-9-20223€90

 

I want to have the following table:

Date(UserID) 1(UserID) 2(UserID) 3
08-11-2022truefalsefalse
09-11-2022truefalsefalse
10-11-2022truefalsefalse

 

Does anyone know how to achieve this?

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

Hi @Sohan ,

 

You can try this method:

 

New columns:

(UserID) 1 = IF(DATEDIFF(CALCULATE(SUM(Orders[Invoice date]), FILTER('Orders','Orders'[UserID] = 1)), 'Table'[Date],DAY) <= 30, TRUE(),FALSE())
(UserID) 2 = IF(DATEDIFF(CALCULATE(SUM(Orders[Invoice date]), FILTER('Orders','Orders'[UserID] = 2)), 'Table'[Date],DAY) <= 30, TRUE(),FALSE())
(UserID) 3 = IF(DATEDIFF(CALCULATE(SUM(Orders[Invoice date]), FILTER('Orders','Orders'[UserID] = 3)), 'Table'[Date],DAY) <= 30, TRUE(),FALSE())

The result is:

vyinliwmsft_0-1668147065675.png

 

Or there are an another method. I agree with the @amitchandak  to create a new table and a new measure, then use matrix visual:

New table:

Table 2 = CALENDAR(TODAY()-3, TODAY())

New measure:

Measure1 =
CALCULATE (
    SUM ( 'Orders'[Revenue] ),
    FILTER (
        'Orders',
        DATEDIFF ( 'Orders'[Invoice date], MAX ( 'Table 2'[Date] ), DAY ) <= 30
    )
)
    <> BLANK ()

And use matrix visual:

vyinliwmsft_1-1668147979015.png

 

 

 

 

 

Hope this helps you. Here is my PBIX file.

 

Best Regards,

Community Support Team _Yinliw

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

2 REPLIES 2
v-yinliw-msft
Community Support
Community Support

Hi @Sohan ,

 

You can try this method:

 

New columns:

(UserID) 1 = IF(DATEDIFF(CALCULATE(SUM(Orders[Invoice date]), FILTER('Orders','Orders'[UserID] = 1)), 'Table'[Date],DAY) <= 30, TRUE(),FALSE())
(UserID) 2 = IF(DATEDIFF(CALCULATE(SUM(Orders[Invoice date]), FILTER('Orders','Orders'[UserID] = 2)), 'Table'[Date],DAY) <= 30, TRUE(),FALSE())
(UserID) 3 = IF(DATEDIFF(CALCULATE(SUM(Orders[Invoice date]), FILTER('Orders','Orders'[UserID] = 3)), 'Table'[Date],DAY) <= 30, TRUE(),FALSE())

The result is:

vyinliwmsft_0-1668147065675.png

 

Or there are an another method. I agree with the @amitchandak  to create a new table and a new measure, then use matrix visual:

New table:

Table 2 = CALENDAR(TODAY()-3, TODAY())

New measure:

Measure1 =
CALCULATE (
    SUM ( 'Orders'[Revenue] ),
    FILTER (
        'Orders',
        DATEDIFF ( 'Orders'[Invoice date], MAX ( 'Table 2'[Date] ), DAY ) <= 30
    )
)
    <> BLANK ()

And use matrix visual:

vyinliwmsft_1-1668147979015.png

 

 

 

 

 

Hope this helps you. Here is my PBIX file.

 

Best Regards,

Community Support Team _Yinliw

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

amitchandak
Super User
Super User

@Sohan , Create a measure and put the Date on row, User on column, and measure on the value of matrix

measure  =

var _cnt = countrows(Table)

return

If(isblank(_cnt),false(), true())

 

You can also consider pivot in power query https://radacad.com/pivot-and-unpivot-with-power-bi

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.