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
Vroom_Master3
Helper I
Helper I

Running Monthly Total of Passing Scores Given a Previous Constant

Hello all. 

I have a data set that combines a lot of Audits. This data is also just now moving to Automation, so I'm having to deal with a previous total. 

This comes together in two parts. I have a "Constant" variable and the actual calculation. 

The "Constant" : 

If(AND(Min('Table'[Month]) = 'Table'[Month], Min('Table'[Year] = 'Table'[Year])), 83,Calculate( ??? ))

This checks that it is the first month of data, and if it is, passes my previous constant from manual collection 83. If it isn't, it is supposed to calculate the Max or average of the previous month's value for this column. This is stored as your constant. For the first month in data collection it is basing its total off of this value. Then it adds this value, whether first month or a month after, to the total of audits in that month that score above a certain grade. That I also have problems with. I need all the values in the current month that pass my two filters to be counted and added to the constant. 

Var Constant
Return Constant + Calculate(CountRows('table'[ID]),Filter('table', ???)

\\\ 'table'[Score] >= 72 , 'table'[Audit_Type] = "Certification" 

 This should in theory be the same value for every row in a month so I can easily reference it in a month graph. I do not know how to reference all values in month from a row in calculated column, nor do i know how to reference previous data in the column I am currently in.  

This could also be a faulty line of thinking, it took me forever to come up with this way to solve my problem, but there might be another way that avoids these two problems with DAX that I am having. Or there is simple enough DAX out there that this can be implemented. I am completely unsure, but I would greatly appreciate some help. 

1 ACCEPTED SOLUTION
Vroom_Master3
Helper I
Helper I

I figured it out. 

I made a calculated column that returns 1 or 0 based on hitting all my filters

Bronze Cert = If(
    AND(
        CONTAINSSTRING(
            'Table'[Type of Audit], 
            "Certification"
        ),
        'Table'[Sum Scores] >= 72
    ),
    1,
    0
)

 

Then I did a measure that does a running total with some logic for adding my previous number in an if statement. 

## Audit RT = Calculate(
     SUM(
        'Table'[Bronze Cert]),
         Filter(
            All(
                'Table'
            ),
                'Table'[Date of Audit] <= max('Table'[Date of Audit]
            )
         ),
     'Table'[Area] = "External"
) + IF(
        MIN(
            'Table'[Date of Audit]
         )
        > Date(2024,1,31), 9, blank()  //This is set to just before my data started so that I dont add 9 to every month in my date table. 
     )

View solution in original post

6 REPLIES 6
Vroom_Master3
Helper I
Helper I

I figured it out. 

I made a calculated column that returns 1 or 0 based on hitting all my filters

Bronze Cert = If(
    AND(
        CONTAINSSTRING(
            'Table'[Type of Audit], 
            "Certification"
        ),
        'Table'[Sum Scores] >= 72
    ),
    1,
    0
)

 

Then I did a measure that does a running total with some logic for adding my previous number in an if statement. 

## Audit RT = Calculate(
     SUM(
        'Table'[Bronze Cert]),
         Filter(
            All(
                'Table'
            ),
                'Table'[Date of Audit] <= max('Table'[Date of Audit]
            )
         ),
     'Table'[Area] = "External"
) + IF(
        MIN(
            'Table'[Date of Audit]
         )
        > Date(2024,1,31), 9, blank()  //This is set to just before my data started so that I dont add 9 to every month in my date table. 
     )
Ashish_Mathur
Super User
Super User

Hi,

Not sure of how much i can help but i would like to try.  Share some data to work with and show the expected result in a simple Table format.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

THanks! Here is some data.

DateMonthYearAudit TypeScore
24-JanJanuary2024Full68
30-JanJanuary2024Cert72
31-JanJanuary2024Cert80
2-FebFebruary2024Full59
4-FebFebruary2024Cert96
6-FebFebruary2024Full48
14-FebFebruary2024Full18
18-FebFebruary2024Cert58
19-FebFebruary2024Full64
25-FebFebruary2024Cert69
1-MarMarch2024Full78
4-MarMarch2024Full75
5-MarMarch2024Cert84
7-MarMarch2024Full91
15-MarMarch2024Full53
18-MarMarch2024Cert95
30-MarMarch2024Full48
2-AprApril2024Full75
10-AprApril2024Cert76
12-AprApril2024Cert90
16-AprApril2024Full100
22-AprApril2024Cert81

 

Here is the expected outcome given the previous constant and a passing score of 72. It is additive only when the Cert Audit has a score of 72 or more. 

Pre-Constant68
Jan69
Feb70
Mar72
Apr75

Sorry but just cannot understand your question.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Sorry. Okay. 

I'm moving some audits from on paper to automated. Part of data collection is the amount of sites that have certified. Before I started automating there was already a number of sites that were certified. So I need to make a running total of all sites that have certified so that I can represent it in a monthly bar graph that looks like this: 

Vroom_Master3_0-1713874206558.png

In Power Bi I don't know how to make a running total that is reactive with a starting number. My automation starts recently so I have to import the '21' from above make a running count that is additive to the 21, only adding where the Type of audit was a certification and the score was above the passing grade. I used 72 as the passing score in my example data. 

Vroom_Master3
Helper I
Helper I

After trying some stuff, this is as far as I could get with the second problem, this adds everything up, but isnt exclusive to every month. just shows the total of all data. It exports the same value for every row. 

 

Var Constant
RETURN Constant + Calculate(
    Countrows('Table'),
    Filter(All('Table'),
        AND(Month('Table'[Date_of_Audit]) = 'Table'[Month], YEAR('Table'[Date_of_Audit]) = 'Table'[Year])), 

    FILTER('Table', 
        'Table'[Score] >=72 ), 
    Filter('Table', 
        CONTAINSSTRING('Table'[Type_Audit], "Silver Certification")))

 

 

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!

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.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.