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
kalpanaV
Helper IV
Helper IV

Do calculation on cell level

Hi

Capture.PNG

Here, i want to display in the new column  for the first row (2/45)1*12

second row =( (2+3)/24)2*12

third row =((3+2+1)/30)/3*12

how to write dax.

11 REPLIES 11
tringuyenminh92
Memorable Member
Memorable Member

Hi @kalpanaV,

 

Your fomular is not clear. but you could create calculated column:

% attr = 
var currentIndex= Data[Index]
var currentHC= Data[HC]
var total = CALCULATE(SUM(Data[V]),FILTER(Data,Data[Index]<=currentIndex))
return 12* DIVIDE(total,Data[HC]*currentIndex)

1.PNG

 

 

hi 

Thanks 

 

but the thing is,  i have to take HC from other table which is having four months of data.

V column is the one which i have to take count having only V from another column in the same table.

 

hope, i explained clear now

Anonymous
Not applicable

It would help if you would include your model and desired results.

Sure, I will give the headers since the data is confidential.

 

AttritionAttritionCapacityCapacity

Two tables called Attrition and Capacity

 

In the attrition table , column "Resignation type"..its having info about Voluntary(V) or Involuntary(NV).

In the capacity table, four months of data is there. i grouped by month wise

so finally it will be having two columns called count(HC), Month.

 

OutputOutput

Hope , you got it. what i want. 

 

Hi @kalpanaV,

 

In this case, you could use @Anonymous (using calculated measure) or my solution (using calculated column), both of them will achieve the column V % (YTD attrition %) for you. For overall YTD, hope you provide its fomular and we could suggest more expression.

i tried , i didnt get the right answer.

@kalpanaV,

 

To get a much more effective solution, please simplify your model with dummy data and show us the exact output.

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

AttritionAttritionCapacityCapacityOutputOutput

 

HC is the head count of Capacity table

V and NV is resignation type.rest of all we have to calculate.Untitled.png

formula used :        % attr =
var currentIndex= Attrition[Month_Key]
var currentHC= Capacity[Month_Wise]
var total = CALCULATE(SUM(Attrition[User Id]),FILTER(Attrition,Attrition[Month_Key]<=currentIndex))
return 12* DIVIDE(total,Capacity[Month_Wise]*currentIndex)

can anyone , help me on this?

Hi @kalpanaV,

 

I got your situation cause i'm used to work with HR data, for beginner, the simple way is you use "group by" (Summarize method or Addcolumns with Summarize method) to generate new table like your picture. Or you could let me observe your sample transaction data to have proper solution(cause i'm not sure that could achieve your requirement with one measure expression)

 

 

Anonymous
Not applicable

Hi @kalpanaV,

 

You should use a iterator function like SUMX to do row based calculations. 

The formula might need a little change because only in the third row i see you divide the result by 3*12 and because there is no desired result please check if the formule is fully correct.

 

First define a measure that counts the V column as a running total, I called it YTD but actually it uses the Index now. Consider using a date column so you could use an actual YTD function. Below the V_YTD and calculation like described.

 

V_YTD = 
VAR CurrentIndex = MAX('Table'[Index])
RETURN
CALCULATE( SUM('Table'[v]);
	FILTER(
		ALLSELECTED('Table');
		'Table'[Index] <= CurrentIndex
	))

NewCalc = 
VAR V = SUM('Table'[v])
VAR HC = SUM('Table'[HC])
VAR V_YTD = [V_YTD]
RETURN
SUMX(
	'Table';
	(V_YTD/HC)/'Table'[Index] * 12)

Result:

 

result.JPG

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.