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
Anonymous
Not applicable

Problem with total on a measure

Hi, i have been working with the next data model and have found a few troubles working with measures to show the total:

Data ModelData Model

 

mi calendar is this and i manage it with "accounting period"

 

Periods tablePeriods table

 

and finally i have the table with the measures, the first and the second one are a simple sum of rev column (rev table) named "[rev uf]" and collect (collect table) named "[collect uf]"and this two are the only ones that come from this two tables.

 

MeasuresMeasures

 

then i have all my measures:

 

CxC_i = [Rev UF]-[Collect UF]

 

- CxC_t = if(CALCULATE([CxC_i],FILTER(all(Periodos),Periodos[Accounting Period]<=SELECTEDVALUE(Periodos[Accounting Period])))<0.1,0,CALCULATE([CxC_i],FILTER(all(Periodos),Periodos[Accounting Period]<=SELECTEDVALUE(Periodos[Accounting Period]))))

 

-CxC_i_Signo = SUMX('Project Financial Billings',if([CxC_t]>0,if('Project Financial Revenue'[Rev UF]>0,'Project Financial Revenue'[Rev UF],0)+if([Collect UF]<0,[Collect UF]*-1,0),if('Project Financial Revenue'[Rev UF]<0,'Project Financial Revenue'[Rev UF],0)+if([Collect UF]>0,[Collect UF],0)))

 

CxC_i_Distinto = SUMX('Project Financial Billings',if([CxC_t]>0,if('Project Financial Revenue'[Rev UF]<=0,'Project Financial Revenue'[Rev UF],0)+if([Collect UF]>0,[Collect UF]*-1,0),if([Rev UF]>0,'Project Financial Revenue'[Rev UF],0)+if([Collect UF]<=0,[Collect UF]*-1,0)))
 
- Days = if(DATEDIFF(max('Project Financial Billings'[collect_fechames]),date(2020,4,1),DAY)=0,1,DATEDIFF(max('Project Financial Billings'[collect_fechames]),date(2020,4,1),DAY))

 

- SUMA_FIFO = IF(ABS(CALCULATE([CxC_i_Distinto],ALL(Periodos[Accounting Period])))>ABS(CALCULATE([CxC_i_Signo],FILTER(ALL(Periodos[Accounting Period]),Periodos[Accounting Period]<=SELECTEDVALUE(Periodos[Accounting Period])))),0,CALCULATE([CxC_i_Distinto],ALL(Periodos[Accounting Period]))+CALCULATE([CxC_i_Signo],FILTER(ALL(Periodos[Accounting Period]),Periodos[Accounting Period]<=SELECTEDVALUE(Periodos[Accounting Period]))))

 

- DSO_Days = if (HASONEFILTER(Periodos[Accounting Period]),ROUND(IFERROR(if([SUMA_FIFO]=0,0,([SUMA_FIFO]-[fifo_anterior])*[Days]/[CxC_t]*SIGN([CxC_t])),1),0),CALCULATE(ROUND(IFERROR(if([SUMA_FIFO]=0,0,([SUMA_FIFO]-[fifo_anterior])*[Days]/[CxC_t]*SIGN([CxC_t])),1),0),FILTER(all(Periodos[Accounting Period]),Periodos[Accounting Period]<=SELECTEDVALUE(Periodos[Accounting Period]))))
 
 
 
Finally my problem is that my final measure [DSO Days] does not show the sum in the total section, in the project 113 should return 31 and in the project 56 should return 8, i have tried with calculate to unfilter the periods table but still not working.
 
Thank you for your time!! 
1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous ,

 

Measures are based on context so they are always calculated based on the filters, columns, slicers and so on that you have on your visualizations. In this case this type of calculation needs to have an aggregator measure you need to do something similar to this:

 

DSO TOTAL = IF(HASONEVALUE(Periodos[Accounting Period]), [DSO_Days], SUMX(Periodos,[DSO_Days]))

 

Then use this measure in the matrix. be aware that the table names and columns may needs changes.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @Anonymous ,

 

Measures are based on context so they are always calculated based on the filters, columns, slicers and so on that you have on your visualizations. In this case this type of calculation needs to have an aggregator measure you need to do something similar to this:

 

DSO TOTAL = IF(HASONEVALUE(Periodos[Accounting Period]), [DSO_Days], SUMX(Periodos,[DSO_Days]))

 

Then use this measure in the matrix. be aware that the table names and columns may needs changes.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.