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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
NeZ_AL
Regular 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.

 

NeZ_AL_0-1670992888744.png

 

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:
 
NeZ_AL_1-1670993077551.png

 

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

 

NeZ_AL_2-1670993146599.png

 

And when i removed the GRUPO FIELD i get this:

 

NeZ_AL_3-1670993191977.png

 

I would like to have this at the end:

 

NeZ_AL_4-1670993615190.png

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

 

Best Regards,

 

 

 

 

 

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @NeZ_AL 

please try

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
    )
)

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @NeZ_AL 

please try

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
    )
)

Thank you very much.

It works perfectly.

 

Best regards,

Nestor

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors