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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Dax help

Hi I need help trying so how many repairs are logged against an address.

 

My data set contains data from the past 5 years

 

Currently I have the overall total which I had done by using SQL to count based on address reference 'Repair Count' [Count of Repairs]

 

The idea is that when you filter by year the measure will take into account the values per year i.e.

 

House 1 – had 15 repairs raised in 2017 so the group it falls into for that year is “Between 10 and 15"

However if we were looking at 2016, 2017 & 2019 House 1 had 45 repairs raised therefore the group it falls into is “Between 30 and 90"

 

The dax for the groupings is below for reference.

 

Number Of Repairs Groups =

VAR x = 'Repair Count' [Count of Repairs]

RETURN

SWITCH(

   TRUE(),

   x >= 0 && x <= 5, "Between 0 and 5",

   x >= 6 && x <= 10, "Between 6 and 10",

   x >= 10 && x <= 30, "Between 10 and 30",

   x >= 30 && x <= 90, "Between 30 and 90",

   x >= 90 && x <= 150, "Between 90 and 150",

   "150+ and above"

)

1 ACCEPTED SOLUTION
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

I think a measure is suitable because you want a dynamic value.

Is 'Repair Count' [Count of Repairs] the number of repairs per address per year? If it is, you could try this measure.

Measure =
VAR x =
    CALCULATE (
        SUM ( 'Repair Count' [Count of Repairs] ),
        ALLEXCEPT ( 'Repair Count', 'Repair Count'[address], 'Repair Count'[year] )
    )
RETURN
    SWITCH (
        TRUE (),
        x >= 0
            && x <= 5, "Between 0 and 5",
        x >= 6
            && x <= 10, "Between 6 and 10",
        x >= 10
            && x <= 30, "Between 10 and 30",
        x >= 30
            && x <= 90, "Between 30 and 90",
        x >= 90
            && x <= 150, "Between 90 and 150",
        "150+ and above"
    )

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

3 REPLIES 3
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

I think a measure is suitable because you want a dynamic value.

Is 'Repair Count' [Count of Repairs] the number of repairs per address per year? If it is, you could try this measure.

Measure =
VAR x =
    CALCULATE (
        SUM ( 'Repair Count' [Count of Repairs] ),
        ALLEXCEPT ( 'Repair Count', 'Repair Count'[address], 'Repair Count'[year] )
    )
RETURN
    SWITCH (
        TRUE (),
        x >= 0
            && x <= 5, "Between 0 and 5",
        x >= 6
            && x <= 10, "Between 6 and 10",
        x >= 10
            && x <= 30, "Between 10 and 30",
        x >= 30
            && x <= 90, "Between 30 and 90",
        x >= 90
            && x <= 150, "Between 90 and 150",
        "150+ and above"
    )

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
kentyler
Solution Sage
Solution Sage

Would looking at the "average # per year" help.

That way it would 15 for one year, and 15 for the three years as well.





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Nathaniel_C
Community Champion
Community Champion

Hi @Anonymous ,

You may be able to drop the date on a matrix, and then drop your other measure Number of Repair Groups as values. 

or House number on Rows, then Years on Columns, then your measure on Values

 

 

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors