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

Calculating sum of values per user using user specific date period

Hi everybody,

 

I'm quite new to Power Bi and am struggling with this task:

 

Calculating value generated of every user in the first 30 days since the Created_At date.

 

Here' s how my data looks like:

Screen Shot 2018-05-28 at 9.16.23 PM.png

The result would be:

User_Id 1234 - $11.00

User_Id 1235 - $25.00

User_Id 1236 - $0.00

 

I'm not even sure how to begin with this - with a calculated collumn next to users table or with a measure. I've managed to do this using Excel without problems, but would like to transfer the calculations to Power Bi. I have set up the relationships between the tables.

 

Would appreciate some tips or hints how to tackle this.

 

Thanks a lot in advance!

Gvido

1 ACCEPTED SOLUTION
Phil_Seamark
Employee
Employee

HI @GvidoB

 

This calculated measure gets pretty close and doesn't rely on any relationships.  I have attached a copy of the PBIX file.

 

Measure = 
VAR x = 
    GENERATE(
        User,
        FILTER(
            'Orders',
            'Orders'[User_Id] = User[User_ID] && 
            'Orders'[Sent_At] < 'User'[Created_At] +30
            )
            )
RETURN SUMX(x,[Value])

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Phil_Seamark
Employee
Employee

HI @GvidoB

 

This calculated measure gets pretty close and doesn't rely on any relationships.  I have attached a copy of the PBIX file.

 

Measure = 
VAR x = 
    GENERATE(
        User,
        FILTER(
            'Orders',
            'Orders'[User_Id] = User[User_ID] && 
            'Orders'[Sent_At] < 'User'[Created_At] +30
            )
            )
RETURN SUMX(x,[Value])

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Thank you, @Phil_Seamark !

 

This works perfectly.

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.