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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
angelc
New Member

calculate total outflow per month

CALCULATE(
SUM(Transactions[Amount]),
FILTER(
Transactions,
Transactions[Amount] < 0 &&
MONTH(Transactions[date]) = MONTH(Bank_Calendar[Date])
)
)

can anyone correct this for me?

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

Hi @angelc ,

First of all, many thanks to @some_bih  for your very quick and effective replies, and I will give some additions below:

1.Create the sample table.

vjiewumsft_0-1710726267462.png

2.Create the calendar table.

vjiewumsft_1-1710726287274.png

3.Create the connection between two tables.

vjiewumsft_2-1710726297226.png

4.Create the measure to calculate the total.

 

Total Per Month = 
VAR sel_mon = SELECTEDVALUE(Bank_Calendar[Date])
RETURN
CALCULATE(
    SUM('Transactions'[Amount]),
    FILTER(
        'Transactions',
        'Transactions'[Amount] < 0 &&
        MONTH('Transactions'[Date]) = MONTH(sel_mon) &&
        YEAR('Transactions'[Date]) = YEAR(sel_mon)
    )
)

 

5.Drag the measure into the table visual. The result is shown below.

vjiewumsft_3-1710726352691.png

 

Best Regards,

Wisdom Wu

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-jiewu-msft
Community Support
Community Support

Hi @angelc ,

First of all, many thanks to @some_bih  for your very quick and effective replies, and I will give some additions below:

1.Create the sample table.

vjiewumsft_0-1710726267462.png

2.Create the calendar table.

vjiewumsft_1-1710726287274.png

3.Create the connection between two tables.

vjiewumsft_2-1710726297226.png

4.Create the measure to calculate the total.

 

Total Per Month = 
VAR sel_mon = SELECTEDVALUE(Bank_Calendar[Date])
RETURN
CALCULATE(
    SUM('Transactions'[Amount]),
    FILTER(
        'Transactions',
        'Transactions'[Amount] < 0 &&
        MONTH('Transactions'[Date]) = MONTH(sel_mon) &&
        YEAR('Transactions'[Date]) = YEAR(sel_mon)
    )
)

 

5.Drag the measure into the table visual. The result is shown below.

vjiewumsft_3-1710726352691.png

 

Best Regards,

Wisdom Wu

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

 

 

some_bih
Super User
Super User

Hi @angelc 

Order is important, if you do not have already it

1. Create Date / Calendar table - link

2. Create connection for Date and Fact table - link

3. v2 for measure 


CALCULATE(
SUM(Transactions[Amount]),
FILTER(
Transactions,
Transactions[Amount] < 0 &&

)
)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors