The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all!
I have a problem and I hope someone can help me.
I have a tabel with 3 columns "Group","Qestion", "Response" like this (and so on)
Group 1 | Q1_G1 | 1 |
Group 1 | Q1_G1 | 2 |
Group 1 | Q2_G1 | 3 |
Group 2 | Q1_G2 | 4 |
Group 3 | Q1_G3 | 8 |
Group 2 | Q1_G2 | 1 |
Group 2 | Q2_G3 | 10 |
Group 3 | Q2_G3 | 0 |
I have this measure:
num_good = CALCULATE(
COUNT('Table1'[Response]),
FILTER('Table1','Table1'[Response]>=9))
I want to modify this measure in such a way that it continues to perform the same calculation excluding the 'Question' equal to 'Q1_G1' and that for the 'Question' 'Q1_G1' it excludes everything else. Is it possible?
Thanks all!
Seba
Solved! Go to Solution.
Hi, @SebaSpotti
Based on your description, I used the following example data:
Create the following measure:
num_good =
SUMX(
VALUES('Table'[Qestion]),
IF(
'Table'[Qestion] = "Q1_G1",
CALCULATE(
COUNT('Table'[Response]),
FILTER(
'Table',
'Table'[Response] >= 9 && 'Table'[Qestion]= "Q1_G1"
)
),
CALCULATE(
COUNT('Table'[Response]),
FILTER(
'Table',
'Table'[Response] >= 9 &&'Table'[Qestion] <> "Q1_G1"
)
)
)
)
Here are the results:
If you have any questions, please feel free to ask me.
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @SebaSpotti
Based on your description, I used the following example data:
Create the following measure:
num_good =
SUMX(
VALUES('Table'[Qestion]),
IF(
'Table'[Qestion] = "Q1_G1",
CALCULATE(
COUNT('Table'[Response]),
FILTER(
'Table',
'Table'[Response] >= 9 && 'Table'[Qestion]= "Q1_G1"
)
),
CALCULATE(
COUNT('Table'[Response]),
FILTER(
'Table',
'Table'[Response] >= 9 &&'Table'[Qestion] <> "Q1_G1"
)
)
)
)
Here are the results:
If you have any questions, please feel free to ask me.
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Try this patter:
IF(
SELECTEDVALUE(Table[Column]) = "Q1_G1",
CALCULATE([num_good],
Table[Column] = "Q1_G1",
CALCULATE([num_good],
Table[Column] <> "Q1_G1")))
If this works for you, kindly mark as solution so it's easier for anyone with similar challenges to find the solution.