cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Frequent Visitor

## Need help with running total measure

Hello,

I have a dataset which has portfolios, months on book(MOB), and mob_buckets (groupings of portfolios into mob <=3, between 4 and 6, between 7 and 9, etc.). I have created a measure ltr_001_perc which calculates the proportion of accounts in each portfolio which had a letter sent to them during one of the mob or mob buckets (see below).

{

var ltr = SUM(TBL_PORT_PERF_FINAL[LTR_001])
var a = sum(dist_pool_id[ACCT_COUNT])
var b = CALCULATE(a, ALLEXCEPT(TBL_PORT_PERF_FINAL, TBL_PORT_PERF_FINAL[POOL_ID]))

return
divide(ltr, b)
}

I have also created a cumulative measure which shows a running total on each mob (see below).
{
calculate(
[ltr_001_perc],
filter(
allselected(TBL_PORT_PERF_FINAL[MOB]),
isonorafter(TBL_PORT_PERF_FINAL[MOB], max(TBL_PORT_PERF_FINAL[MOB]), desc)
)
)
}

I need to replicate this measure for mob buckets but everything I try is incorrect. This is what I am currently working with, but yields inaccurate results that drop off at mob bucket 9

{
var MaxDate = SELECTEDVALUE(TBL_PORT_PERF_FINAL[MOB_BUCKET])
var Result =
CALCULATE(
[ltr_001_perc],
TBL_PORT_PERF_FINAL[MOB_BUCKET]<= MaxDate,
ALL(TBL_PORT_PERF_FINAL[MOB_BUCKET])
)

return
Result
}
2 REPLIES 2
Super User

@lngshrmn_phil See if this helps: Better Running Total - Microsoft Power BI Community

If not, Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Frequent Visitor

This is a few columns of one portfolio.

``````POOL_ID|POOL_ID_SHORT|PURCH_ENT|FUND_MO                |VINTAGE|MOB|MOB_BUCKET|
-------+-------------+---------+-----------------------+-------+---+----------+
BARNI3 |BAR          |Core     |2021-12-01 00:00:00.000|   2021|  0|3         |
BARNI3 |BAR          |Core     |2021-12-01 00:00:00.000|   2021|  1|3         |
BARNI3 |BAR          |Core     |2021-12-01 00:00:00.000|   2021|  2|3         |
BARNI3 |BAR          |Core     |2021-12-01 00:00:00.000|   2021|  3|3         |
BARNI3 |BAR          |Core     |2021-12-01 00:00:00.000|   2021|  4|6         |
BARNI3 |BAR          |Core     |2021-12-01 00:00:00.000|   2021|  5|6         |
BARNI3 |BAR          |Core     |2021-12-01 00:00:00.000|   2021|  6|6         |
BARNI3 |BAR          |Core     |2021-12-01 00:00:00.000|   2021|  7|9         |
BARNI3 |BAR          |Core     |2021-12-01 00:00:00.000|   2021|  8|9         |
BARNI3 |BAR          |Core     |2021-12-01 00:00:00.000|   2021|  9|9         |
BARNI3 |BAR          |Core     |2021-12-01 00:00:00.000|   2021| 10|12        |
BARNI3 |BAR          |Core     |2021-12-01 00:00:00.000|   2021| 11|12        |
BARNI3 |BAR          |Core     |2021-12-01 00:00:00.000|   2021| 12|12        |
BARNI3 |BAR          |Core     |2021-12-01 00:00:00.000|   2021| 13|>12       |
BARNI3 |BAR          |Core     |2021-12-01 00:00:00.000|   2021| 14|>12       |``````

My expected output for the bottom visual is something like you see in the top visual (see below). As you can see, even when disregarding the stalling summation, the numbers are incorrect as each mob bucket should match the corresponding mob from the top visual.

Announcements

#### Fabric certifications survey

Certification feedback opportunity for the community.

#### Power BI Monthly Update - April 2024

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

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors