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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

equivalent of this statement in power bi

ROUND((SUM(CASE WHEN CHALLENGERESULT = 'ABC' AND CREATEDTIMESTAMP BETWEEN TRUNC(TO_DATE('26-JAN-2019','DD-MON-YYYY'))-8 AND TRUNC(TO_DATE('26-JAN-2019','DD-MON-YYYY')) THEN 1 ELSE NULL END)/SUM(CASE WHEN CHALLENGERESULT IS NOT NULL AND CREATEDTIMESTAMP BETWEEN TRUNC(TO_DATE('26-JAN-2019','DD-MON-YYYY'))-8 AND TRUNC(TO_DATE('26-JAN-2019','DD-MON-YYYY')) THEN 1 ELSE NULL END))*100,2)


How to implement this in power bi ? 

 

Here we have a column in our database named CHALLENGERESULT that contains 3 types of values : 'ABC', 'DEF' and 'OTHERS'

Please help me with the same.

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

Try

 

Calc =
var _date1 = date(2016,01,26)
var _date2 = date(2016,01,26)+8

calculate(countroes(table),filter(table, challengeresult = 'ABC' && createdtimestamp>=_date1 && createdtimestamp<=_date2))/
calculate(countroes(table),filter(table, not(isblank(challengeresult)) && createdtimestamp>=_date1 && createdtimestamp<=_date2))

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

Give ABC in " instead of '

"ABC" and Try

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

7 REPLIES 7
amitchandak
Super User
Super User

Try

 

Calc =
var _date1 = date(2016,01,26)
var _date2 = date(2016,01,26)+8

calculate(countroes(table),filter(table, challengeresult = 'ABC' && createdtimestamp>=_date1 && createdtimestamp<=_date2))/
calculate(countroes(table),filter(table, not(isblank(challengeresult)) && createdtimestamp>=_date1 && createdtimestamp<=_date2))

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

It is giving me an error "cannot find table 'ABC' ".

But 'ABC is the value that is there in the column CHALLENGERESULT'

How to solve this issue ?


Please share your formula

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

W %Adjusted Last Period = ROUND((CALCULATE(COUNTROWS(TABLE),FILTER(TABLE,TABLE[CHALLENGERESULT] = 'ABC' && TABLE[CREATEDTIMESTAMP].[Date] >= ( SELECTEDVALUE('DATE TABLE'[Date] ) - W_LAST_PERIOD_NO_DAYS ) && TABLE[CREATEDTIMESTAMP].[Date] < (SELECTEDVALUE('DATE TABLE'[Date]) - W_NO_DAYS ) + W_NO_DAYS )) /

 

CALCULATE(COUNTROWS(TABLE),FILTER(TABLE, NOT((ISBLANK(MVIEW_PRICING_CHALLENGES[CHALLENGERESULT])) && TABLE[CREATEDTIMESTAMP].[Date] >= ( SELECTEDVALUE('DATE TABLE'[Date] ) - W_NO_DAYS ) && TABLE[CREATEDTIMESTAMP].[Date] < (SELECTEDVALUE('DATE TABLE'[Date]) - W_NO_DAYS ) + W_NO_DAYS ))))*100,2)

Please Check

Give ABC in " instead of '

"ABC" and Try

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks @amitchandak  !!

Anonymous
Not applicable

Hi , 

I have shared the formula.
Can you please suggest how to correct the same ?

Thanks !

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors