cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Frequent Visitor

Count number of events when using three different related tables

I have 3 tables related to each other, the first is Total_Pol (here there is monthly frequency data identified as a subgrupo), in the second Category_Total table (there are geological details of subgrupo and other sub-categories) and the third table Master_Total (there is the detail to which grupo each subgrupo belongs to, coordinates, etc).

I joined the tables as follows because they have a lot of data between them.

Although the values come in subgrupo, it is only valid to know the total per month at the grupo level.

I am trying to obtain the number of active groups per month, for which it is considered that if at least one subgroup of each group is greater than 0, the group is considered active.

I used teh current formula:

Count_Group = if(sumx(total_pol, Total_Pol[VALUE_FIX])>0,CALCULATE(DISTINCTCOUNT(Total_Pol[VALUE_FIX]),GROUPBY(Master_Total,Master_Total[GRUPO])),0)

And get the following Table:

When i removed the SUBGRUPO FIELD from the table i get this:

And when i removed the GRUPO FIELD i get this:

I would like to have this at the end:

Hope that makes sense!   I'd be grateful for any help.

Best Regards,

1 ACCEPTED SOLUTION
Super User

Hi @NeZ_AL

``````Count_Group =
SUMX (
CALCULATETABLE (
VALUES ( Master_Total[GRUPO] ),
CROSSFILTER ( Total_Pol[SUBGROUPO], Category_Total[SUBGROUPO], BOTH )
),
IF (
CALCULATE (
SUM ( Total_Pol[VALUE_FIX] ),
CROSSFILTER ( Total_Pol[SUBGROUPO], Category_Total[SUBGROUPO], BOTH )
) > 0,
1
)
)``````
2 REPLIES 2
Super User

Hi @NeZ_AL

``````Count_Group =
SUMX (
CALCULATETABLE (
VALUES ( Master_Total[GRUPO] ),
CROSSFILTER ( Total_Pol[SUBGROUPO], Category_Total[SUBGROUPO], BOTH )
),
IF (
CALCULATE (
SUM ( Total_Pol[VALUE_FIX] ),
CROSSFILTER ( Total_Pol[SUBGROUPO], Category_Total[SUBGROUPO], BOTH )
) > 0,
1
)
)``````
Frequent Visitor

Thank you very much.

It works perfectly.

Best regards,

Nestor

Announcements

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Monthly Update - August 2024

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

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Fabric Community Update - September 2024

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

Top Solution Authors
Top Kudoed Authors