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
ponchibonos
Frequent Visitor

Percentages without null values and Dates

Hello @Irwan  and colleagues.

Some weeks ago I made this post https://community.fabric.microsoft.com/t5/Desktop/Percentages-without-null-values/m-p/4732647#M14122... about the procedure to calculate Porcentages without null values. @Irwan propouse a really good alternative.

Now I need the percentage calculations to be made taking into account only the last form that was answered.


I would like to know if it is possible to make a DAX that allows to do the following:
1. I have a form that several people have answered (Form 1, Form2,...).
2. The form is about three topics (Topic 1, Topic 2, Topic 3...)
3. Each form has 12 questions, of which 4 are from Topic 1, 3 from Topic 2 and 5 from Topic 3.
4. The column Percentage of each question represents the values of each question, the sum of each Topic is 100%. That is to say that all the affirmative questions of Topic 1 add up to 100% and likewise for Topic 2 and Topic 3.
5. The column “Percentage result” represents the answers given in the form, in which there is the option to answer the questions “Not applicable”, this value is reflected in the values “null”.

What I need is a DAX that allows that the “null” values are not quantified in the calculation of the percentages.

6. Takes only the latest form submission per person.

Some examples of what I need:
a) When no value is filtered, the maximum sum of the "percentage of each question" is 600, the sum of "Percentage result" is 385, I would like to calculate a percentage in which all the "null" values are not evaluated, in this case the "null" values add up to 135, so the calculation of the percentage would have to be =(385*100)/(600-135) = 82.79%.

b) If “Form 1” is filtered, the maximum value of “percentage of each question” is 300 and the sum of “Percentage result” is 175 and the “null” values are 70, so the value sought is =(175*100)/(300-70)= 76%.

c) Finally, if Question 1 is filtered the maximum value of the sum of percentage of each question is 40, the value in Percentage result is 20 and the sum of the null values is 20. So the calculation would have to be: =(20*100)/(40-20) = 100%.

I hope you can help me.

I leave the example of the table

 

FormYearTopicsQuestionsPercentage of each questionPercentage result
Form 12024Topic 1Question 120null
Form 12024Topic 1Question 21010
Form 12024Topic 1Question 3300
Form 12024Topic 1Question 44040
Form 12024Topic 2Question 54040
Form 12024Topic 2Question 620null
Form 12024Topic 2Question 74040
Form 12024Topic 3Question 82020
Form 12024Topic 3Question 9150
Form 12024Topic 3Question 102525
Form 12024Topic 3Question 1130null
Form 12024Topic 3Question 12100
Form 22025Topic 1Question 12020
Form 22025Topic 1Question 210null
Form 22025Topic 1Question 33030
Form 22025Topic 1Question 44040
Form 22025Topic 2Question 540null
Form 22025Topic 2Question 62020
Form 22025Topic 2Question 74040
Form 22025Topic 3Question 82020
Form 22025Topic 3Question 915null
Form 22025Topic 3Question 10250
Form 22025Topic 3Question 113030
Form 22025Topic 3Question 121010
      
   SUM600385
10 REPLIES 10
ponchibonos
Frequent Visitor

Hello, colleagues. Apologies for not responding sooner; I was ill and unable to do so.
Thank you for all your responses. I believe my explanation of what I need was unclear.

I already have the DAX that calculates the percentages without evaluating the null values. What I need is a measure, in addition to the previous calculation, to only calculate the most recent response when there are two responses from the same person. In the example from my model, Person 1 responded in 2024 and 2025, so I need the measure to only calculate for the year 2025 for the Person 1.

 

ponchibonos_0-1754610564711.png

ponchibonos_1-1754610594401.png

 

Here is the pbix file

Percentages and Dates 

 

Thanks in advanced.

 

 

Hello @ponchibonos,
I’ve reviewed your requirement and was able to reproduce it successfully. I adjusted the DAX measure so it calculates % Answered (excluding nulls) but only for the most recent year per person when multiple years of responses exist.

Key changes made:

  • The calculation now filters to each person’s latest year.
  • Null values are still excluded from the calculation, as in your original logic.
  • Result is correct at 52.94% for your sample dataset.

For your reference, I’ve attached the updated .pbix file so you can review the changes and logic directly.

vssriganesh_0-1754729312528.png

 

Best regards,
Ganesh Singamshetty.

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1754699675665.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-ssriganesh
Community Support
Community Support

Hello @ponchibonos,
Could you please confirm if your query has been resolved by the provided solutions? This would be helpful for other members who may encounter similar issues.

 

Thank you for being part of the Microsoft Fabric Community.

v-ssriganesh
Community Support
Community Support

Hello @ponchibonos,

Hope everything’s going great on your end. Just checking in has the issue been resolved or are you still running into problems? Sharing an update can really help others facing the same thing.

Thank you.

v-ssriganesh
Community Support
Community Support

Hello @ponchibonos,

We hope you're doing well. Could you please confirm whether your issue has been resolved or if you're still facing challenges? Your update will be valuable to the community and may assist others with similar concerns.

Thank you.

v-ssriganesh
Community Support
Community Support

Hello @ponchibonos,
Thank you for reaching out to the Microsoft Fabric Forum Community.

I have reproduced your scenario in Power BI using sample data and created a measure that dynamically calculates the expected percentage based on slicer selection.

Here’s the DAX measure I used:

% Answered (Excluding Nulls) =

VAR _SumAnswered =

    SUM('Table'[Percentage result])

VAR _SumExpected =

    CALCULATE(

        SUM('Table'[Percentage of each Question]),

        FILTER(

            'Table',

            NOT ISBLANK('Table'[Percentage result])

        ),

        REMOVEFILTERS('Table'[Form], 'Table'[Question])                    

    )

RETURN

    DIVIDE(_SumAnswered * 100, _SumExpected)
  • The numerator only includes actual responses
  • The denominator remains fixed and unfiltered by slicers (to calculate true expectations)

For your reference, I’m attaching the .pbix file where you can test and validate the output and thank you, @Irwan for sharing valuable insights.


If this information is helpful, please “Accept as solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.

Irwan
Super User
Super User

hello @ponchibonos 

 

here is the result using exact same DAX as previous one.

Value Sought =
var _Sum1 = SUM('Table'[Percentage result])
var _Sum2 =
CALCULATE(
    SUM('Table'[Percentage of each Question]),
    FILTER(
        'Table',
        not ISBLANK('Table'[Percentage result])
    )
)
Return
DIVIDE(
    _Sum1,
    _Sum2
)
 

6a. no filter

Irwan_0-1753052014079.png

6b. Form 1 filter

Irwan_1-1753052033093.png

6c. Question 1 filter

Irwan_2-1753052054327.png

 

i am not sure what is the difference from previous post, but let us know what is your expected/desired goal.

 

Hope this will help.

Thank you.

Ashish_Mathur
Super User
Super User

Hi,

That is a lot of text.  Based on the tabe that you have shared, give a brief description and show the expected result.


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

This one measure will perform all the necessary calculations. Just create a new measure in Power BI and paste in this code.

Important: Make sure to replace 'YourTable' with the actual name of your data table.

 

Adjusted Percentage =
-- This formula first identifies the latest submission for each form/person
-- and then calculates the score, excluding any questions marked as "Not applicable" (null).

VAR LatestSubmissionsTable =
ADDCOLUMNS (
'YourTable',
"IsLatest",
// This checks if the current row's year is the maximum year for that specific form.
// This effectively finds the latest submission for each form ID.
IF (
'YourTable'[FormYear] = CALCULATE ( MAX ( 'YourTable'[FormYear] ), ALLEXCEPT ( 'YourTable', 'YourTable'[Form] ) ),
1,
0
)
)
VAR FilteredToLatestOnly =
FILTER ( LatestSubmissionsTable, [IsLatest] = 1 )

-- Numerator: Sum of the actual scores from the latest forms.
VAR ActualScore =
SUMX ( FilteredToLatestOnly, 'YourTable'[Percentage result] )

-- Denominator: Sum of the potential scores, but ONLY for questions that were actually answered (not null).
VAR PotentialScore =
SUMX (
FILTER ( FilteredToLatestOnly, NOT ISBLANK ( 'YourTable'[Percentage result] ) ),
'YourTable'[Percentage of each question]
)

-- Final Calculation: Divide the actual score by the adjusted potential score.
VAR Result =
DIVIDE ( ActualScore, PotentialScore )

RETURN
Result

 

If this explanation and solution resolve your issue, please like and accept the solution.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors