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.
Hi !
Please, help with this task:
I have 4 simple tables with some relations like in screenshot. How can I build result table?
Result description:
For C1 category we have 2 Contacts Co1, Co2. This Contacts took part into 2 Activities Call1, Call2. So, result for C1 category is 2.
For C2 category we don't have any Contacts. Due to this fact, we don't have any Activities.
For Non Seg category we don't have any Contacts too. Due to this fact, we don't have any Activities too. But, only in this case, we must calculate result like "All Activities - Activities for Categories". So, result for Non Seg Category is 3-2=1
Also, result table is matrix, which have categories from Category table in columns!
Solved! Go to Solution.
Hi, @Vitaliy
Please check the below picture and the sample pbix file's link down below, whether it is what you are looking for.
Activity Count =
IF (
SELECTEDVALUE ( Catetory[ID] ) = "Non Seg",
CALCULATE ( COUNTROWS ( ContactActivity ), ALLSELECTED ( ContactActivity ) )
- CALCULATE (
DISTINCTCOUNT ( ContactActivity[Callid] ),
ALLSELECTED ( Catetory )
),
IF (
NOT ISBLANK ( SELECTEDVALUE ( Catetory[ID] ) ),
COALESCE ( DISTINCTCOUNT ( ContactActivity[Callid] ), 0 ),
BLANK ()
)
)
https://www.dropbox.com/s/o3665ejobsuhyhe/vitaliy.pbix?dl=0
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: https://www.linkedin.com/in/jihwankim1975/
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi, @Vitaliy
Please check the below picture and the sample pbix file's link down below, whether it is what you are looking for.
Activity Count =
IF (
SELECTEDVALUE ( Catetory[ID] ) = "Non Seg",
CALCULATE ( COUNTROWS ( ContactActivity ), ALLSELECTED ( ContactActivity ) )
- CALCULATE (
DISTINCTCOUNT ( ContactActivity[Callid] ),
ALLSELECTED ( Catetory )
),
IF (
NOT ISBLANK ( SELECTEDVALUE ( Catetory[ID] ) ),
COALESCE ( DISTINCTCOUNT ( ContactActivity[Callid] ), 0 ),
BLANK ()
)
)
https://www.dropbox.com/s/o3665ejobsuhyhe/vitaliy.pbix?dl=0
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: https://www.linkedin.com/in/jihwankim1975/
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hey @Vitaliy ,
please try with the following measure:
Acitvities =
VAR vActivities = IF( MAX( Category[Id] ) <> BLANK(), COUNTROWS( ContactActivity ) )
VAR vAllActivities =
CALCULATE(
COUNTROWS( ContactActivity ),
ALL( Category[Id] )
)
VAR vActivitiesForCategories =
CALCULATE(
COUNTROWS( ContactActivity ),
Category[Id] <> BLANK()
)
RETURN
IF(
ISINSCOPE( Category[Id] ) && MAX( Category[Id] ) = "Non seg",
vAllActivities - vActivitiesForCategories,
vActivities
)
This will produce the following result:
You can check my file here:
https://www.swisstransfer.com/d/e3eeb216-2ce4-491a-bd3d-0cb4f39794d6
Thanks for your response!
I think this is not quite what I need, cause if we add some new calls into Activity table (for example Call4, Call5) and this calls would be without contacts (no rows in ContactActivity table for this new calls) - result would be the same as you wrote. But, for my case, result must be: C1 == 2, C2 == 0, Non Seg == 3. Or I'm wrong ?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |