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.
Can someone help me to calculate each record with F as 2 count and M as one count, please refer below.
Record | |||||
F | |||||
F | |||||
F | |||||
F | |||||
M | |||||
M | |||||
M | |||||
Total count | 11 | ||||
Note: Each record with F is equivalent to 2 and M is equivalent to 1 |
Solved! Go to Solution.
Hi @CJ_96601 ,
I have crate an index column first in query editors to count conveniently.
Then you can create a measure like this:
Total count =
CALCULATE (
COUNT ( 'Table'[Record] ),
FILTER ( 'Table', 'Table'[Record] = "F" )
) * 2
+ CALCULATE (
COUNT ( 'Table'[Record] ),
FILTER ( 'Table', 'Table'[Record] = "M" )
)
You will get the result:
Here is the demo, please try it:
Best Regards,
Yingjie Li
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hi @CJ_96601 ,
I have crate an index column first in query editors to count conveniently.
Then you can create a measure like this:
Total count =
CALCULATE (
COUNT ( 'Table'[Record] ),
FILTER ( 'Table', 'Table'[Record] = "F" )
) * 2
+ CALCULATE (
COUNT ( 'Table'[Record] ),
FILTER ( 'Table', 'Table'[Record] = "M" )
)
You will get the result:
Here is the demo, please try it:
Best Regards,
Yingjie Li
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Thanks. it works as per my requirements
you can have column like this and sum
new Column = If(Table[Record]="F",2,1)
or
sumx(values(Table[Record]),If(Table[Record]="F",2,1))
or
sumx(selectcolumns(Table,"ID",Table[record],"_sum",If(Table[Record]="F",2,1)),[_sum])
Thanks.
I want to count the records as follows:
F
F
M
Based on the below sample. Total count is 5
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 |
---|---|
115 | |
100 | |
89 | |
68 | |
61 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |