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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
MP_123
Microsoft Employee
Microsoft Employee

Calculated Measure problem

hi, i have column in my table that has specific values for months until Nov(CortanaHeavy,CortanaMedLight), and from December other values(CortanaHeavy,CortanaLight,CortanaMedium).

i want to create a pie chart with measure filtered by this column.

i have also month slicer

if month previous December is selected, there is no problem, also if only December is selected.

the problem is when selecting both November and December.

i want to to show in the report only the November values (CortanaHeavy,CortanaMedLight).

cortana heavy - need to sum all of this measure with this value (same for Nov and Dec)

Cortana Med light - need to sum CortanaMedLight(November)+CortanaLight+CortanaMedium(December)

 

i wrote this measure: but for some reason it  shows only the CortanaHeavy Value

 

Views = if(And(month(min(Query1[Date]))<12,month(max(Query1[Date]))>11),IF(HASONEVALUE(Query1[Engagement Cohort]),
if(values(Query1[Engagement Cohort])="CortanaHeavy",sum(Query1[CardViewed]),IF(HASONEVALUE(Query1[Engagement Cohort]),if(values(Query1[Engagement Cohort])="CortanaLight",0,if(values(Query1[Engagement Cohort])="CortanaMedium",0,CALCULATE(sum(Query1[CardViewed]),filter(all(Query1[Engagement Cohort]),Query1[Engagement Cohort]="CortanaMedLight"))+CALCULATE(sum(Query1[CardViewed]),filter(all(Query1[Engagement Cohort]),Query1[Engagement Cohort]="CortanaMedium"))+CALCULATE(sum(Query1[CardViewed]),filter(all(Query1[Engagement Cohort]),Query1[Engagement Cohort]="CortanaLight"))))))))

 

it's a bit messy because i tried different ways to make it work 😞

Capture23.PNG

 

 

attached image to see that there are values to sum, and the measure that calculated for the first only

 

thanks!

6 REPLIES 6
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @MP_123,

You’d better create a column which recognize the Engagement Cohort and Month, then create a measure to calculate the result. I try to reproduce your scenario using the following sample data and get expected result.
 
1.png

First create month and record columns using the formulas below.

Month = MONTH(Test3[Date])

Recard = IF(Test3[Month]=12,IF(Test3[Engagement Cohort ]="CortanaMedLight",CALCULATE(Test3[CardView1],FILTER(Test3,AND(Test3[Engagement Cohort ]="CortanaMedLight",Test3[Month]=12)))+CALCULATE(Test3[CardView1],FILTER(Test3,AND(Test3[Engagement Cohort ]="CortanaLight",Test3[Month]=12)))+CALCULATE(Test3[CardView1],FILTER(Test3,AND(Test3[Engagement Cohort ]="CortanaMedium",Test3[Month]=12))),IF(Test3[Engagement Cohort ]="CortanaHeavy",1,0)),1)

 
2.png

Then create two measures as follows.

CardView1 = COUNTA(Test3[Engagement Cohort])

View = SUM(Test3[Recard])



Finally, create a table and slicer including the month. When you select the December, it display the first result, when you select the November and  December, it still return the desired result.

3.png4.png
 
 

If you have any other issue, please feel free to ask.

Best Regards,
Angelia

@v-huizhn-msft

hi Angelia,

thank you very much for your help!

 

i forgot to mention that the report's data source is on direct query ( can't change it since the table is very big)

and this calculated column can't be added in direct query mode 😞

 

thanks!

Hi @MP_123,

Do you mean you don't create calculated column in Direct Query model? As I tested it, I can create calculated column in Direct Query model as follows. Please note the highlithed in red wire frame.

1.png

Best Regards,
Angelia

yes it's possible to add new column, but can't use the calculate and filter functions.

65.PNG

 

Hi @MP_123,

Got it, I will reproduce it on my local computer, and post the update here. Thanks for understanding.

Best Regards,
Angelia

thank you!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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