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
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

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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])

@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.

@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

 

 

 

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors