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
Bhavana_k
Helper I
Helper I

Why cant I add column to a New Measure?

I am new in Power BI. I want to perform very basic calculation, where i'll check

Calc1 = 
if no>=200 then good
else if no >500 Very Good

else if no >=100 AND <200 then bad

END

once that is done, then I want calculate no. of bad and good like below

calc2 =

if calc1="bad" then count(bad)

else if calc1 = "Good" then count (Good)

else calc1 = "very Good" then count(Very Good)
END


This no. which I have mentioned is nothing but difference between dates in day
DATEDIFF(craetedate,today(),day) 

but this is calculated column which I made from a date column. 

Now as it's a column i cannot pull it in calculated measure. But to do the aggregation like count I need to pull this column in measure which is not happening. And calc1 is also in calculated column.

What should I do? This is taking much longer than i though. 
Any help would be appreciated.

Thank you,
Bhavana

1 ACCEPTED SOLUTION
v-qiuyu-msft
Community Support
Community Support

Hi @Bhavana_k

 

It looks like you want to use the calculated column ( Column= DATEDIFF(craetedate,today(),day) ) in a measure, right? 

 

You can use the aggregate functions eg: COUNT, SUM, MAX,..,etc. 

Measure = MAX('table'[Column])

 

You can go through these links to learn more about how to create measures: 

 

https://docs.microsoft.com/en-us/power-bi/desktop-measures

https://docs.microsoft.com/en-us/power-bi/desktop-tutorial-create-measures

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
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

2 REPLIES 2
v-qiuyu-msft
Community Support
Community Support

Hi @Bhavana_k

 

It looks like you want to use the calculated column ( Column= DATEDIFF(craetedate,today(),day) ) in a measure, right? 

 

You can use the aggregate functions eg: COUNT, SUM, MAX,..,etc. 

Measure = MAX('table'[Column])

 

You can go through these links to learn more about how to create measures: 

 

https://docs.microsoft.com/en-us/power-bi/desktop-measures

https://docs.microsoft.com/en-us/power-bi/desktop-tutorial-create-measures

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-qiuyu-msft ,

 

Thank you, it helped me. 🙂
This is what I did, I just want to others if they come across same problem.
I have a column which gets difference between two dates lets say day_diff_no= DATEDIFF(createddate,today(),'day')
I have set data type of this column to whole number.

Now another new measure I made from your help which is CheckCategory  and this is what I wrote

CheckCategory =
IF(SUM(Table1[day_diff_no])>= 4000,"Danger",IF(SUM(Table1[day_diff_no])>=1000 &&
SUM(Table1[day_diff_no])<4000,"Bad",IF(SUM(Table1[day_diff_no])<1000 &&
SUM(Table1[day_diff_no])>=500,"Neutral",IF(SUM(Table1[day_diff_no])<500 && SUM(Table1[day_diff_no])>=200,"Good","Very Good"))))

Hope this helps!!

Thank you,
Bhavana

 

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.