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
moltrasms
New Member

calculate credits used based on date and user

I am trying to figure out how to calculate the credits used by each user each day.  the source of the credits is a totalizer for each user. I am putting the information in google sheets.  I am trying to calculate automatically the Credits used column in the below table. 

date time Email Credits Credits used
5/24/2022 1:15:00 PM user1 18240 Not Calculated
5/24/2022 1:15:00 PM user2 16112 Not Calculated
5/24/2022 1:15:00 PM user3 17842 Not Calculated
5/24/2022 1:15:00 PM user4 48344 Not Calculated
5/25/2022 1:00:00 PM user1 37445 19205
5/25/2022 1:00:00 PM user2 57836 41724
5/25/2022 1:00:00 PM user3 17842 0
5/25/2022 1:00:00 PM user4 70942 22598
5/25/2022 1:00:00 PM User5 3566 3566
5/26/2022 1:30:00 PM user1 42,840 5,395
5/26/2022 1:30:00 PM user2 107,535 49,699
5/26/2022 1:30:00 PM user3 21,762 3,920
5/26/2022 1:30:00 PM user4 86,393 15,451
5/26/2022 1:30:00 PM User5 4,392 826
5/27/2022 3:30:00 PM user1 48,235 5,395
5/27/2022 3:30:00 PM user2 157,234 49,699
5/27/2022 3:30:00 PM user3 25,681 3,920
5/27/2022 3:30:00 PM user4 101,844 15,451
5/27/2022 3:30:00 PM user5 5,218 826

 

 

The calculation can be done in Google Sheets, Power Query, or Dax which every is best.

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

Hi @moltrasms ,

 

Please check the formula.

Column = 
var next = CALCULATE(SUM('Table'[Credits]),FILTER('Table','Table'[Email]=EARLIER('Table'[Email])&&'Table'[date]=EARLIER('Table'[date])-1))
var used = 'Table'[Credits]-next
return
IF(used='Table'[Credits],"Not Calculated",FORMAT(used,""))

vjaywmsft_0-1653963297437.png

 

Best Regards,

Jay

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

View solution in original post

1 REPLY 1
v-jayw-msft
Community Support
Community Support

Hi @moltrasms ,

 

Please check the formula.

Column = 
var next = CALCULATE(SUM('Table'[Credits]),FILTER('Table','Table'[Email]=EARLIER('Table'[Email])&&'Table'[date]=EARLIER('Table'[date])-1))
var used = 'Table'[Credits]-next
return
IF(used='Table'[Credits],"Not Calculated",FORMAT(used,""))

vjaywmsft_0-1653963297437.png

 

Best Regards,

Jay

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

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.