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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
spandy34
Responsive Resident
Responsive Resident

Cummulative by Street

Hi have the following table  that includes a Street Name, No of Properties (which is a measure of the Count of UPRNs) and I want to add a Cummulative Measure for me to add a to a matrix.

 

Please can someone tell me how I would write the DAX please.

 

spandy34_0-1687888479493.png

@amitchandak @tamerj1 @goncalogeraldes 

2 ACCEPTED SOLUTIONS
Martin_D
Super User
Super User

Hi @spandy34 ,

With this measure calculating the number of properties (without cummulation):

 

 

# Properties = SUM ( 'Properties by Street'[No of Properties] )

 

 

this measure calculates the cummulative number of properties by street:

 

 

# Properties cummulating by street = 
VAR _UpToStreet = MAX ( 'Properties by Street'[STREE_NAME] )
RETURN
CALCULATE (
    [# Properties],
    'Properties by Street'[STREE_NAME] <= _UpToStreet
)

 

 

Be aware that the order by which is cummulated is defined by the measure, not by the visual. I.e., if you sort the table by a different column, cummulation is not done top to bottom but still by street name alphabetically ascending. If you want to cummulate differently, you need a different measure.
BR
Martin

 

github.pnglinkedin.png

View solution in original post

tamerj1
Super User
Super User

Hi @spandy34 

please try

Cumulative =
VAR CurrentStreet =
SELECTEDVALUE ( 'Table'[STREET_NAME] )
RETURN
SUMX (
FILTER (
ALLSELECTED ( 'Table'[STREET_NAME] ),
'Table'[STREET_NAME] <= CurrentStreet
),
[No of Properties]
)

View solution in original post

3 REPLIES 3
spandy34
Responsive Resident
Responsive Resident

Thank you it's worked appreciate your response.

tamerj1
Super User
Super User

Hi @spandy34 

please try

Cumulative =
VAR CurrentStreet =
SELECTEDVALUE ( 'Table'[STREET_NAME] )
RETURN
SUMX (
FILTER (
ALLSELECTED ( 'Table'[STREET_NAME] ),
'Table'[STREET_NAME] <= CurrentStreet
),
[No of Properties]
)

Martin_D
Super User
Super User

Hi @spandy34 ,

With this measure calculating the number of properties (without cummulation):

 

 

# Properties = SUM ( 'Properties by Street'[No of Properties] )

 

 

this measure calculates the cummulative number of properties by street:

 

 

# Properties cummulating by street = 
VAR _UpToStreet = MAX ( 'Properties by Street'[STREE_NAME] )
RETURN
CALCULATE (
    [# Properties],
    'Properties by Street'[STREE_NAME] <= _UpToStreet
)

 

 

Be aware that the order by which is cummulated is defined by the measure, not by the visual. I.e., if you sort the table by a different column, cummulation is not done top to bottom but still by street name alphabetically ascending. If you want to cummulate differently, you need a different measure.
BR
Martin

 

github.pnglinkedin.png

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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