cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lw24
Frequent Visitor

Sum of Distinct columns by Created Previous Month Date

Hello all! 

 

Here's the data I'm trying to calc the previous months (February) data based on these distinct columns: 

 

lw24_0-1678485842798.png

 

Thank you!!

1 ACCEPTED SOLUTION
lw24
Frequent Visitor

Thank you, gave that one a shot but wasn't quite what I was looking for. I'd been working on this seperately with this formula and got to what I needed, not sure if this is efficient?...

 

New Column = 

CALCULATE(

SUMX(

DISTINCT (Table'[ID]), CALCULATE(MAX('Table'[Amount]))),

DATESINPERIOD('Table'[Created Date],MAX('Table'[Created Date]),-30,DAY))

 

 

View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @lw24 

please try

NewColumn =
VAR T1 =
CALCULATETABLE (
'Table',
ALLEXCEPT (
'Table',
'Table'[File Date],
'Table'[Name],
'Table'[ID],
'Table'[Created Date]
)
)
VAR T2 =
FILTER (
T1,
FORMAT ( 'Table'[File Date], "YYMM" ) = FORMAT ( 'Table'[Created Date], "YYMM" )
)
RETURN
MAXX ( T, 'Table'[Amount] ) + 0

lw24
Frequent Visitor

Thank you, gave that one a shot but wasn't quite what I was looking for. I'd been working on this seperately with this formula and got to what I needed, not sure if this is efficient?...

 

New Column = 

CALCULATE(

SUMX(

DISTINCT (Table'[ID]), CALCULATE(MAX('Table'[Amount]))),

DATESINPERIOD('Table'[Created Date],MAX('Table'[Created Date]),-30,DAY))

 

 

FreemanZ
Community Champion
Community Champion

hi @lw24 

the logic is not very clear. could you elaborate it?

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors