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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
myou
Helper II
Helper II

Get the LAST NON BLANK SCORE Per SubCategory, then AVG the result for the Category Level

Get Last Non Blank Score Per SubCategory then Average it all up

 

DataModel:

Data ModelData Model

In Measuress Table I have Score, I want to get the last non blank value per Subcategory

 

Capture123.JPG

I managed to get the last non blank value per subcategory, but when it comes to Category level the result becomes wrong

I am getting 33% while it should be 28%

 
DAX USed:

 

Measures_Score_AVG_Score =
CALCULATE (
    AVERAGE ( Measuress[Measure_Score] ),
    FILTER (
        Measuress,
        Measuress[EndDate]
            = CALCULATE (
                LASTNONBLANK ( Measuress[EndDate], TRUE () ),
                FILTER ( Measuress, Measuress[Measure_Actual] <> BLANK () )
            )
    )
)
​

 

powerbi.JPG

 

PBIX FILE : https://gofile.io/d/R2ABeq

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

28% is wrong.  The score for Toyota was on Jan 1, not on Feb 1, and should therefore not be considered.

lbendlin
Super User
Super User

33% is correct because the lastnonblank date for "Cars"  is Feb 1 20, and it has two values of .5 and .15, and the average of these is .325

Hi @lbendlin , I Want a formula to generate the 28%

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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