Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello community!
I have a task, need your help to solve it.
We have two tables, one of them - date and month; second - customer and product ID's, number of line.
Based on one month (february) our goal is to count how many rows do we have in this month but with specific conditions:
1) If data in collum "contract" = "own production", "trading", then we count all those rows seperately as unique ones
2) If data in collum "contract" <> "own production", "trading", then we consider only unique data. For example we have 3 rows with same number 1817, in this case we count only as 1 unique row
In example (february) we have 22 rows. So the goal in our example, considering conditios I mentioned abowe, should be 19 unique rows
Example file pbix
Thank you in advance!
Solved! Go to Solution.
Hi,
Please check the below picture and the measure.
fix measure =
VAR conditiontable =
FILTER ( Plan, Plan[Contract] IN { "Own production", "Trading" } )
VAR nonconditiontable =
SUMMARIZE ( EXCEPT ( Plan, conditiontable ), Plan[Contract] )
RETURN
COUNTROWS ( conditiontable ) + COUNTROWS ( nonconditiontable )
In this example, you can use an IF() statement to check whether the column has the value you wish, and then returns a different count depending on it.
"IN()" checks the value against a list of values.
EG
Hi,
Please check the below picture and the measure.
fix measure =
VAR conditiontable =
FILTER ( Plan, Plan[Contract] IN { "Own production", "Trading" } )
VAR nonconditiontable =
SUMMARIZE ( EXCEPT ( Plan, conditiontable ), Plan[Contract] )
RETURN
COUNTROWS ( conditiontable ) + COUNTROWS ( nonconditiontable )
Ні, @Jihwan_Kim
Thanks for the help, your measure worked
Greetings from Ukraine.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
7 | |
6 |
User | Count |
---|---|
15 | |
13 | |
11 | |
9 | |
8 |