cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

New Member

## Help creating a measure to show cumulative values by week and category within a matrix visual

Hi folks, Hopng someone can help show me how to create a measure to populate a matrix visual as described below

Here is an example of my source data:

 Week Category Value 9/2/2023 A 1 9/2/2023 C 4 9/2/2023 D 5 9/9/2023 A 7 9/9/2023 B 3 9/9/2023 D 5 9/16/2023 A 4 9/16/2023 B 7 9/16/2023 C 8

From this data I am trying to create a matrix visual that resembles the following:

 Week Cumulative Value 9/2/2023 10 A 1 B 0 C 4 D 5 9/9/2023 25 A 8 B 3 C 4 D 10 9/16/2023 44 A 12 B 10 C 12 D 10 Total 44

Note each week includes the cumulative total up through that week, as well as the cumulative totals for each category (to show what is comprising the cumulative total at that week).

Each week shows all categories and their respective cumulative values through that week (or at least, each week should begin including them the first time they register a value, then continue including for subsequent weeks even in weeks when they do not register a new value)

Categories only appear in the data when they have registered a value for that week (otherwise they do not appear in the data for that week. For example in above data, Category "D" in week 9/16/2023)

1 ACCEPTED SOLUTION
Super User

create a proper data model

To report on things that are not there you need to use a crossjoin and a measure.

``````Cumul =
var w = max(Weeks[Week])
return 0+CALCULATE(sum(Facts[Value]),Weeks[Week]<=w)``````

2 REPLIES 2
Super User

create a proper data model

To report on things that are not there you need to use a crossjoin and a measure.

``````Cumul =
var w = max(Weeks[Week])
return 0+CALCULATE(sum(Facts[Value]),Weeks[Week]<=w)``````

New Member

Brilliant, thank you!

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

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

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors