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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors