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.
Hello,
I have a column that has a number of 1's and 0's and I want to count how many 1's there are and 0's there are as they are base don a different column.
I have tried to use the below measure but for some reason it doesn't work... please assist:
Measure = CALCULATE(
COUNTROWS(Table_query),
FILTER(Table_query, Table_query[Recharge Decision] = "1"),
FILTER(Table_query,Table_query[Recharge Decision] ="0"))
Solved! Go to Solution.
Hi @Anonymous ,
You need to split your measure into 2,1 is for calculating the number of 1's and the other is for the number of 0's:
If the data of the column is a text type,using:
Measure for 1 = CALCULATE(
COUNTROWS(Table_query),
FILTER(Table_query, Table_query[Recharge Decision] = "1")
Measure for 0= CALCULATE(
COUNTROWS(Table_query),
FILTER(Table_query, Table_query[Recharge Decision] ="0"),
If the data of the column is a whole number type,using:
Measure for 1 = CALCULATE(
COUNTROWS(Table_query),
FILTER(Table_query, Table_query[Recharge Decision] = 1)
Measure for 1 = CALCULATE(
COUNTROWS(Table_query),
FILTER(Table_query, Table_query[Recharge Decision] = 0)
@amitchandak Hi I am trying to use these measures to calculate rows for my stock.
But it is bringing back not what I expect.
I know that total amount of row are 4572, but measure brings back only 4204.
Ideally I would like to avoid using filter inside measure so that I could use visual filter so used could filter on any value.
I have other measure that, but it breaks when I add stores to the table.
I attached sample file if it helps
https://we.tl/t-LVpPk1HQoq
Hi @Anonymous ,
You need to split your measure into 2,1 is for calculating the number of 1's and the other is for the number of 0's:
If the data of the column is a text type,using:
Measure for 1 = CALCULATE(
COUNTROWS(Table_query),
FILTER(Table_query, Table_query[Recharge Decision] = "1")
Measure for 0= CALCULATE(
COUNTROWS(Table_query),
FILTER(Table_query, Table_query[Recharge Decision] ="0"),
If the data of the column is a whole number type,using:
Measure for 1 = CALCULATE(
COUNTROWS(Table_query),
FILTER(Table_query, Table_query[Recharge Decision] = 1)
Measure for 1 = CALCULATE(
COUNTROWS(Table_query),
FILTER(Table_query, Table_query[Recharge Decision] = 0)
If there other values then 1 and 0 then
Measure = CALCULATE(
COUNTROWS(Table_query),
FILTER(Table_query, Table_query[Recharge Decision] = "1" || Table_query[Recharge Decision] ="0"))
Other wise create 2 measures
Measure1 = CALCULATE(
COUNTROWS(Table_query),
FILTER(Table_query, Table_query[Recharge Decision] = "1" ))
Measure2 = CALCULATE(
COUNTROWS(Table_query),
FILTER(Table_query, Table_query[Recharge Decision] ="0"))
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 |
---|---|
107 | |
93 | |
77 | |
65 | |
53 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |