Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I need to sum the latest total asset of two companies. Please advise how to write the measure. Below is my table. Result should be 7,916,759 + 40,000,000 = 47,916,579
Solved! Go to Solution.
Hi, @hongyuliu
You can try the following methods.
Calculated column:
Last non blank date =
CALCULATE (
MAX ( [Date] ),
FILTER (
'Table',
[Source] = EARLIER ( 'Table'[Source] )
&& NOT ( ISBLANK ( [Total Asset] ) )
)
)
Sum =
CALCULATE (
SUM ( 'Table'[Total Asset] ),
FILTER ( 'Table', [Date] = [Last non blank date] )
)
Measure:
Last non blank date M =
CALCULATE (
MAX ( [Date] ),
FILTER (
ALL('Table'),
[Source] = MAX( 'Table'[Source] )
&& NOT ( ISBLANK ( [Total Asset] ) )
)
)
Sum M =
CALCULATE (
SUM ( 'Table'[Total Asset] ),
FILTER ( ALL ( 'Table' ), [Date] = [Last non blank date M] )
)
Use the field "Last non blank date" to avoid the problem of taking the maximum value of "Total Asset" instead of the last non blank value.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @hongyuliu
You can try the following methods.
Calculated column:
Last non blank date =
CALCULATE (
MAX ( [Date] ),
FILTER (
'Table',
[Source] = EARLIER ( 'Table'[Source] )
&& NOT ( ISBLANK ( [Total Asset] ) )
)
)
Sum =
CALCULATE (
SUM ( 'Table'[Total Asset] ),
FILTER ( 'Table', [Date] = [Last non blank date] )
)
Measure:
Last non blank date M =
CALCULATE (
MAX ( [Date] ),
FILTER (
ALL('Table'),
[Source] = MAX( 'Table'[Source] )
&& NOT ( ISBLANK ( [Total Asset] ) )
)
)
Sum M =
CALCULATE (
SUM ( 'Table'[Total Asset] ),
FILTER ( ALL ( 'Table' ), [Date] = [Last non blank date M] )
)
Use the field "Last non blank date" to avoid the problem of taking the maximum value of "Total Asset" instead of the last non blank value.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @hongyuliu ,
You can create two measure like below for getting required output:-
Distinct_comapny_asset =
MAXX (
DISTINCT ( 'Table'[Source] ),
LASTNONBLANKVALUE ( 'Table'[Source], MAX ( 'Table'[Total Asset] ) )
)
Sum_of_assets =
SUMX ( DISTINCT ( 'Table'[Source] ), [Distinct_comapny_asset] )
output:-
Note:- I have 7,916,559 instead of 7,916,759 due to which output is not matching but it will match at your end.
Below is my table snapshot:-
Thanks,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
@hongyuliu
You can use this measure to total by source, it will add the last nonblank value based on the latest date for each source
Total =
SUMX(
VALUES(Table1[Source]),
LASTNONBLANKVALUE( Table1[Date], SUM(Table1[Total Asset] ))
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
96 | |
77 | |
63 | |
55 |
User | Count |
---|---|
143 | |
109 | |
89 | |
84 | |
66 |