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
Amircal
Regular Visitor

My own Total grupo

I need help calculating the total percentage per group and the expiration per group, keeping in mind that each line in the group is a different measure 😞

Example:

Amircal_0-1715694349795.png

 

8 REPLIES 8
Amircal
Regular Visitor

Solved.

Anonymous
Not applicable

Hi, @Amircal 

Thanks for @xifeng_L reply. I'm glad you were able to solve the problem. Could you please be able to share your solution to help more people with similar problems refer to your solution, thank you very much.

Best Regards,
Yang
Community Support Team

xifeng_L
Super User
Super User

Can provide some sample data or pbix? And what is the calculate logic?

Hi, 

This is the measure for Vencimiento:

Test:=
 
VAR _Empresa=SELECTEDVALUE(DimEmpresas[IdEmpresa])
VAR _Grupo=SELECTEDVALUE(Antiguedadcxc[BusinessPartnerGroupName])
VAR _currentAgingBucket=MAX(OrdenVencimiento[AgingBucket])
 
VAR SelectedAgingBucket=
    SWITCH(TRUE(),
SELECTEDVALUE(OrdenVencimiento[AgingOrder])=1, CALCULATE([MedidaFiltrosVencido], CROSSFILTER( OrdenVencimiento[AgingBucket], Antiguedadcxc[AgingBucket],Both)),
SELECTEDVALUE(OrdenVencimiento[AgingOrder])=2, CALCULATE([MedidaFiltrosAbonosFuturos], CROSSFILTER( OrdenVencimiento[AgingBucket], Antiguedadcxc[AgingBucket],Both)),
SELECTEDVALUE(OrdenVencimiento[AgingOrder])=3, CALCULATE([TotalCarteraGroup], CROSSFILTER( OrdenVencimiento[AgingBucket], Antiguedadcxc[AgingBucket],Both)),
SELECTEDVALUE(OrdenVencimiento[AgingOrder])=4, CALCULATE([MedidaFiltros0-30], CROSSFILTER( OrdenVencimiento[AgingBucket], Antiguedadcxc[AgingBucket],Both)),
SELECTEDVALUE(OrdenVencimiento[AgingOrder])=5, CALCULATE([MedidaFiltros31-60], CROSSFILTER( OrdenVencimiento[AgingBucket], Antiguedadcxc[AgingBucket],Both)),
SELECTEDVALUE(OrdenVencimiento[AgingOrder])=6, CALCULATE([MedidaFiltros61-90], CROSSFILTER( OrdenVencimiento[AgingBucket], Antiguedadcxc[AgingBucket],Both)),
SELECTEDVALUE(OrdenVencimiento[AgingOrder])=7, CALCULATE([MedidaFiltros91-120], CROSSFILTER( OrdenVencimiento[AgingBucket], Antiguedadcxc[AgingBucket],Both)),
SELECTEDVALUE(OrdenVencimiento[AgingOrder])=8, CALCULATE([MedidaFiltros>120],  CROSSFILTER( OrdenVencimiento[AgingBucket], Antiguedadcxc[AgingBucket],Both)),
SELECTEDVALUE(Antiguedadcxc[BusinessPartnerGroupName])=_Grupo, [TotalCarteraGroup],
SELECTEDVALUE(Antiguedadcxc[IdEmpresa])=_Empresa, [TotalCarteraEmpresa],[TotalCartera])
 
return IF(ISBLANK(SelectedAgingBucket),0,SelectedAgingBucket)


I need to know when is the


This is the measure for Vencimiento:

Test:=
 
VAR _Empresa=SELECTEDVALUE(DimEmpresas[IdEmpresa])
VAR _Grupo=SELECTEDVALUE(Antiguedadcxc[BusinessPartnerGroupName])
VAR _currentAgingBucket=MAX(OrdenVencimiento[AgingBucket])
 
VAR SelectedAgingBucket=
    SWITCH(TRUE(),
SELECTEDVALUE(OrdenVencimiento[AgingOrder])=1, CALCULATE([MedidaFiltrosVencido], CROSSFILTER( OrdenVencimiento[AgingBucket], Antiguedadcxc[AgingBucket],Both)),
SELECTEDVALUE(OrdenVencimiento[AgingOrder])=2, CALCULATE([MedidaFiltrosAbonosFuturos], CROSSFILTER( OrdenVencimiento[AgingBucket], Antiguedadcxc[AgingBucket],Both)),
SELECTEDVALUE(OrdenVencimiento[AgingOrder])=3, CALCULATE([TotalCarteraGroup], CROSSFILTER( OrdenVencimiento[AgingBucket], Antiguedadcxc[AgingBucket],Both)),
SELECTEDVALUE(OrdenVencimiento[AgingOrder])=4, CALCULATE([MedidaFiltros0-30], CROSSFILTER( OrdenVencimiento[AgingBucket], Antiguedadcxc[AgingBucket],Both)),
SELECTEDVALUE(OrdenVencimiento[AgingOrder])=5, CALCULATE([MedidaFiltros31-60], CROSSFILTER( OrdenVencimiento[AgingBucket], Antiguedadcxc[AgingBucket],Both)),
SELECTEDVALUE(OrdenVencimiento[AgingOrder])=6, CALCULATE([MedidaFiltros61-90], CROSSFILTER( OrdenVencimiento[AgingBucket], Antiguedadcxc[AgingBucket],Both)),
SELECTEDVALUE(OrdenVencimiento[AgingOrder])=7, CALCULATE([MedidaFiltros91-120], CROSSFILTER( OrdenVencimiento[AgingBucket], Antiguedadcxc[AgingBucket],Both)),
SELECTEDVALUE(OrdenVencimiento[AgingOrder])=8, CALCULATE([MedidaFiltros>120],  CROSSFILTER( OrdenVencimiento[AgingBucket], Antiguedadcxc[AgingBucket],Both)),



I thinks i have the issue cause i have the "Total General " at the same level has the groups clients but the clients dont have a Group Name Total General 

I need to identify when the selectedrow IT's "Total General"

Hi @Amircal ,

 

You can rewrite the rest like the boxed part in the image below.

 

xifeng_L_0-1715700183130.png

 

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

Hi @xifeng_L 

The problem i have its the selectedvalue for the Total General its Blank, when the ralation dont have data.


Test3:=
VAR _Empresa=SELECTEDVALUE(DimEmpresas[IdEmpresa])
VAR _Grupo=SELECTEDVALUE(Antiguedadcxc[BusinessPartnerGroupName])
VAR _currentAgingBucket=MAX(OrdenVencimiento[AgingBucket])

VAR SelectedAgingBucket= _grupo

return SelectedAgingBucket

Amircal_0-1715712105652.png

I dont know how to explain that :(, i do a relationships 1 to both tables

I can't locate the problem by just looking at the screenshot, can you provide the pbix file or some sample data?

Helpful resources

Announcements
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.