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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
mic_rys
Helper I
Helper I

how to sum fo the prepared measure in the total

Hi, I have a problem with total in my prepared measure, I know that need to user hasonevalue function but my all ideas doesn't work.

My measure:

Fill blank rows 2 =

VAR PrevDate =
MAXX (
FILTER (
ALL ( 'Date' ),
'Date'[Date] < MAX ( 'Date'[Date])
&& NOT ( ISBLANK ( [Fill blank rows first] ) )
),
'Date'[Date]
)
VAR LastValueFill =
CALCULATE (
[Measure1],
FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] = PrevDate )
)
VAR FillEmpty = if( ISBLANK([Fill blank rows first]), LastValueFill,[Fill blank rows first] )


return
IF (
HASONEVALUE ( Clients[Code] ),
FillEmpty
,BLANK()

)
 
In short, this measure inserts the last values if blank.
Instead of Blank in Total I need a sum of the FillEmpty.
Result:
mic_rys_0-1643636560573.png

 

 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @mic_rys,

According to the description, it seems like a common measure total level calculation issues.

If that is the case, I'd like to suggest you refer to the following link to know how to handle this scenario.

Measure Totals, The Final Word 

Regards,

Xiaoxin Sheng

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

@mic_rys , Change the return like

sumx( addcolumns(summarize( Table, Clients[Code] , 'Date'[Year Month]), "_1", calculate(IF ( HASONEVALUE ( Clients[Code] ), FillEmpty ,BLANK() ))), [_1])

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

@amitchandak 

I tried this way but it doesn't sum correctly:

mic_rys_0-1643640930232.png

 

@mic_rys ,

can you simply keep this in return

sumx( addcolumns(summarize( Table, Clients[Code] , 'Date'[Year Month]), "_1", calculate(IF ( HASONEVALUE ( Clients[Code] ), FillEmpty ,BLANK() ))), [_1])

 


Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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

@amitchandak 
It's live connection so it not easy to simplify the data but I can show part of the model which is used.

mic_rys_0-1643706232789.png

The result of your code is:

mic_rys_1-1643706417808.png

 

 

 

Anonymous
Not applicable

Hi @mic_rys,

According to the description, it seems like a common measure total level calculation issues.

If that is the case, I'd like to suggest you refer to the following link to know how to handle this scenario.

Measure Totals, The Final Word 

Regards,

Xiaoxin Sheng

HI, thanks, it helped somewhat! I added extra measure and now it summarizes well!


Last value by customer with filled values =

var _wynikGrand = sumx(
GROUPBY( Tasks, Clients[Code],'Date'[YearMonth] )
, [Filled values]
)

return
_wynikGrand

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.