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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Datediff with calculate

I have a report for investment in bank products, so I have a tabela with the products and the total investment, how many client ids are investing, and the Stars of these clients (1 Star, 2 stars ...)

I had to create a new collum for showing the M1 investment (when a client opens his account at the bank, how much these clients invested in the first month). Was not a problem

 

Captação Total M1 = 

if(datediff(Planilha1[Data de Abertura Conta];Planilha1[Data de Aplicação];MONTH)<=1;Planilha1[Valor Aplicado]) 
(Translating: Captação Total M1 = Total Funding M1 | Data de Abertura Conta = Opening Acc. Date | Data de Aplicação = Apllication Date | Valor Aplicado = Applied Value)
 
Then I used the value per product and the value as total percentage (red box)

 

Now, I have to divide this total percentage value with the star rating (black box). But, now comes my problem. As I created a new collum, I can't use it for diving because it's not a measure. I don't know how to transform that uper formula for collum into a measure, or use this collum formula in a divide or other formula.

 

I tried to transform the collum into a formula: 

Captação Total M1 por Produto = calculate(sum(Planilha1[Valor Aplicado]);datediff(Planilha1[Data Abertura Conta];Planilha1[Data Aplicação];MONTH)<=1) (no good)
 
And tried use in a divide formula, to calculate the per product/total amount
M1 % Por Produto = divide(CALCULATE(sum(Planilha1[Valor Aplicado]);DATEDIFF(Planilha1[Data Abertura Conta];Planilha1[Data Aplicação];MONTH)<=1);[Total de Captação Total M1]) (no good)
 
And, as I'm going to need to divide the total by product, I have already created a formula with the total ([Total Captação Total M1] = CALCULATE(SUM('Planilha1'[Captação Total M1]);ALLSELECTED(Planilha1)). But now, I need to have the Captação Total M1 por Produto
 
Sem título.png

 

 

 

 
0 REPLIES 0

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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