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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

MAA - Calculation

Hello to all,

Can I use this formula:

YTD 2021 = Divide(CALCULATE(COUNTROWS(rclms_qa), FILTER(rclms_qa,rclms_qa[CONFORMITY]="OK"&&rclms_qa[Mars Year]=2021)),CALCULATE(COUNTROWS(rclms_qa), FILTER(rclms_qa,rclms_qa[Mars Year]=2021)))*100
 
And get the results (adding a DAX formula) of the last 13 periods (from today until the last 13 periods).
Thanks
Hervé
1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1624429305598.png

Here are the steps you can follow:

1. Create calculated column.

Period number = VALUE(RIGHT([Period],2))

2. Create measure.

Measure =
var _OK=COUNTX(FILTER(ALL('Table'),[Year]=2021&&[CONFORMITY]="OK"&&[Period number]<=13),[CONFORMITY])
var _total=cOUNTX(FILTER(ALL('Table'),[Year]=2021&&[Period number]<=13),[CONFORMITY])
return
DIVIDE(_OK,_total)

3. Result:

vyangliumsft_1-1624429305602.png

 

Best Regards,

Liu Yang

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

View solution in original post

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1624429305598.png

Here are the steps you can follow:

1. Create calculated column.

Period number = VALUE(RIGHT([Period],2))

2. Create measure.

Measure =
var _OK=COUNTX(FILTER(ALL('Table'),[Year]=2021&&[CONFORMITY]="OK"&&[Period number]<=13),[CONFORMITY])
var _total=cOUNTX(FILTER(ALL('Table'),[Year]=2021&&[Period number]<=13),[CONFORMITY])
return
DIVIDE(_OK,_total)

3. Result:

vyangliumsft_1-1624429305602.png

 

Best Regards,

Liu Yang

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

Fowmy
Super User
Super User

@Anonymous 

Can you share some sample data with the desired output to have a clear understanding of your question? Mention whether you want a calculated column or measure
You can save your files in OneDrive, Google Drive, or any other cloud sharing platforms and share the link here.

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Hello

Here is an example of data:

YearCONFORMITYPeriodFactories
2020OKP13RCA
2020OKP13RCA
2020OKP13RCA
2021OKP01RFT
2021WRNG_NOKP01RFT
2021OKP02RNI
2021OKP02RNI
2021OKP02RNI
2021OKP02RNI
2021OKP02RNI

 

Outcome is % of OK product vs the total (OK/NON OK or Warning) over the last 13 periods.

Hope it helps,

Hervé

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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