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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Sri57
Frequent Visitor

DAX Query

Hello Experts,
I want to write a dax measure for the following scenario:

Sri57_1-1719493079717.png

 

Here, I have a slicer named "Fiscal Year" that contains data like 2019/2020, 2020/2021, etc., in text format. If I select 2023/24 from the slicer assuming as a current slicer, here the latest audit happened for Biscuits for Adequate is 2022/23 and now I want count od Adequate for previous Audit. if there is no previous audit then it should display na. how can write this using dax.
I have placed sample dataset for better understanding.
https://www.dropbox.com/scl/fi/5k46fdr2b2kwrkwyd1mwv/test.pbix?rlkey=gs3e020c91pj4mdwtt5kcsv8t&st=8b...


TIA

3 REPLIES 3
Anonymous
Not applicable

Hi @Sri57 

 

Have you solved your problem? If so, can you share your solution here and mark the correct answer as a standard answer to help other members find it faster? Thank you very much for your kind cooperation!

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@Anonymous HERE IS THE DAX
 PreviousAudit =
VAR CurrentFiscalYear = CALCULATE(max('Audit'[FISCAL_YEAR_ID]),FILTER(Audit,Audit[RATING] = "Adequate"))
var LBOFY = MAXX(FILTER(Audit,Audit[FISCAL_YEAR_ID]<CurrentFiscalYear && Audit[RATING] = "Adequate"),Audit[FISCAL_YEAR_ID])
var result =
CALCULATE(COUNT(Audit[ENGAGEMENT_NAME]),Audit[FISCAL_YEAR_ID]=LBOFY,Audit[RATING]="Adequate")
RETURN IF(result=BLANK(),"na",result)

TIA
lbendlin
Super User
Super User

here the latest audit happened for Biscuits for Adequate is 2022/23 and now I want count od Adequate for previous Audit.

not clear to me what you are trying to achieve.

lbendlin_0-1719536068179.png

 

 

  Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

 

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.