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

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

Reply
cyuan
Frequent Visitor

Sum with condition

Hi all,

 

I’d like to create a sum by quarter but only for month age greater than 3.

 

in below case, the first condition is to look at month age, as long as it is greater than 3, then sum from very first value in sales (Nov 2023 in this case)

 

below is what I used however it didnt return me Nov and Dec 2023 as they are below month age 3 level.

 

N_Sales = if(max('Sales'[MonthAge])<=3,blank(),[Sales])

 

thanks in advance

BizkeySalesDateMonth Age
AAA33321/11/20231
AAA33351/12/20232
AAA33321/01/20243
AAA33311/02/20244
AAA33361/03/20245
AAA33381/04/20246
AAA333101/05/20247
2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1719283806701.png

 

 

expected result: =
VAR _t =
    FILTER (
        Sales,
        CALCULATE ( DATEDIFF ( MAX ( Sales[Date] ), TODAY (), MONTH ) ) > 3
    )
RETURN
    SUMX ( _t, Sales[Sales] )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

Anonymous
Not applicable

Hi @cyuan ,

Thank you @Jihwan_Kim  very much for the solution, and I've tried other ways to help you understand the problem:

I guess what you mean is that you want to ask for the value of sales under your selected month age > 3. Here's a bit of advice for you:

When you use the algorithmic logic you have shown, you need to make sure that it is used in a calculated column and that sales cannot be a value calculated by measure.

Column = if(('Table'[Month Age])<=3,blank(),[Slaes])

vxingshenmsft_0-1719382876589.png

You change to the new data source you need to use in the following actions.

Hope it helps!

 

Best regards,
Community Support Team_ Tom Shen

 

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

4 REPLIES 4
Anonymous
Not applicable

Hi @cyuan ,

Thank you @Jihwan_Kim  very much for the solution, and I've tried other ways to help you understand the problem:

I guess what you mean is that you want to ask for the value of sales under your selected month age > 3. Here's a bit of advice for you:

When you use the algorithmic logic you have shown, you need to make sure that it is used in a calculated column and that sales cannot be a value calculated by measure.

Column = if(('Table'[Month Age])<=3,blank(),[Slaes])

vxingshenmsft_0-1719382876589.png

You change to the new data source you need to use in the following actions.

Hope it helps!

 

Best regards,
Community Support Team_ Tom Shen

 

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

 

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1719283806701.png

 

 

expected result: =
VAR _t =
    FILTER (
        Sales,
        CALCULATE ( DATEDIFF ( MAX ( Sales[Date] ), TODAY (), MONTH ) ) > 3
    )
RETURN
    SUMX ( _t, Sales[Sales] )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thanks Jihwan, i've tried SUMX and it works too. much apprecaited. 

Hi Tom,

 

Thanks for reply. Technically I used the a similar approach which also returns correct values. 

 

cyuan_0-1719788228262.png

 

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.