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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
bbburcu
Frequent Visitor

Ignore blank in calculation add column

Hi all,

 

I have a question for you. I hope, I'll be answered from you quickly. 

As you see attached, I have been calculated previous three rows sum, but I have a condition unfourtunately. My condition is row has until  blank previous three rows get sum. 

My formula is below,

Column 4 = CALCULATE(SUMX('Table','Table'[Column 2]), DATESINPERIOD(('Table'[Tarih].[Date]),
        STARTOFMONTH(DATEADD'Table'[Tarih].[Date], -3MONTH )),3,MONTH),FILTER('Table','Table'[Tarih].[Date] < EARLIER('Table'[Tarih])),FILTER('Table','Table'[Tarih]>= CALCULATE(MIN('Date'[Date]))),'Table'[category]=EARLIER('Table'[category]))
 
bbburcu_0-1667219817177.png

 

How do I calculate ignore blanks?

I need show below,

 

bbburcu_1-1667219840353.png

Many thanks.

Regards.

 

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

Hi, @bbburcu ;

First you could create a month number column which  have a sort column.

Month number = MONTH( CONVERT("2022-" &[Month]&"-1",DATETIME))

The create a column by dax.

Column = 
IF([Month number]<4,BLANK(),
SUMX(
SUMMARIZE(
 TOPN(3,
      FILTER('Table',([Column 2]<>BLANK()||[Column 2]<>0) && [Month number]<EARLIER('Table'[Month number])),
      'Table'[Month number],DESC),
      [Column 2])
      ,[Column 2]))

The final show:

vyalanwumsft_0-1667287250062.png


Best Regards,
Community Support Team _ Yalan 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

4 REPLIES 4
v-yalanwu-msft
Community Support
Community Support

Hi, @bbburcu ;

First you could create a month number column which  have a sort column.

Month number = MONTH( CONVERT("2022-" &[Month]&"-1",DATETIME))

The create a column by dax.

Column = 
IF([Month number]<4,BLANK(),
SUMX(
SUMMARIZE(
 TOPN(3,
      FILTER('Table',([Column 2]<>BLANK()||[Column 2]<>0) && [Month number]<EARLIER('Table'[Month number])),
      'Table'[Month number],DESC),
      [Column 2])
      ,[Column 2]))

The final show:

vyalanwumsft_0-1667287250062.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yalanwu-msft ,

Thank you very much! It's work. 

 

Best wishes,

Burcu

 

amitchandak
Super User
Super User

@bbburcu , Assuming you are need a new column, rolling 3 months

 

New column =

var _date1 = eomonth([Date],-3)

var _date2 = eomonth([Date],-1) +1

return

Sumx(filter(Table, [Date] >= _date1 && [Date] <= _date2), [Column2])

 

if you need a measure

Rolling 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX(Table[date_closed]),-3,MONTH))

 

Rolling Months Formula: https://youtu.be/GS5O4G81fww

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak ,

 

It doesn't work. I have been calculated rolling 3 months ( as you see Column 4) but I have a condition. 

If row is blank, it is not including blank row but total (any three previous row).

 

bbburcu_0-1667224871142.png

As you can see below how can I calculate?

bbburcu_1-1667225040029.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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors