Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
Hi,
I need a measure to calculate with conditions that
Count: Internal Site ID
Condition 1: Category = NDPd
Condition 2: Site Creation(NDPd/IPM) = blank
Result= 23
My try is below and not resulting 23. still showing 32,561 total count of Internal Site ID.
Pls fix and suggest any simpler and better measure.
Solved! Go to Solution.
Hi @jeongkim, Please try the below measure:
NDPd Site Creation =
CALCULATE(
COUNTROWS('Distinct - Master Data'),
'Distinct - Master Data'[Category] = "NDPd",
ISBLANK('Distinct - Master Data'[Site Creation(NDPd/IPM)])
)
Hi @jeongkim ,
You can achieve your goal by this DAX:
NDPd Site Creation =
VAR _filter =
FILTER(
'Distinct - Master Data',
'Distinct - Master Data'[Category] = "NDPd" &&
ISBLANK('Distinct - Master Data'[Site Creation(NDPd/IPM)])
)
RETURN
CALCULATE(
COUNT('Distinct - Master Data'[Internal Site ID]),
_filter
)
Here you go
VAR _filter =
FILTER (
'Distinct - Master Data',
'Distinct - Master Data'[Category] = "NDPd"
&& ISBLANK ( 'Distinct - Master Data'[Site Creation(NDPd/IPM)] )
)
RETURN
CALCULATE ( COUNTROWS ( 'Distinct - Master Data' ), _filter )
COUNTROWS - counts the number of rows in a table
COUNT - Counts the number of rows in the table where the specified column has a non-blank value
if there are no blanks in Internal Site ID column, the result will be the same
Hi @jeongkim ,
You can achieve your goal by this DAX:
NDPd Site Creation =
VAR _filter =
FILTER(
'Distinct - Master Data',
'Distinct - Master Data'[Category] = "NDPd" &&
ISBLANK('Distinct - Master Data'[Site Creation(NDPd/IPM)])
)
RETURN
CALCULATE(
COUNT('Distinct - Master Data'[Internal Site ID]),
_filter
)
This solution also works thanks!
Hi @jeongkim, Please try the below measure:
NDPd Site Creation =
CALCULATE(
COUNTROWS('Distinct - Master Data'),
'Distinct - Master Data'[Category] = "NDPd",
ISBLANK('Distinct - Master Data'[Site Creation(NDPd/IPM)])
)
It works thanks!
Hi @jeongkim
To achieve a distinct count filtered by _filter in DAX using CALCULATE, you must use the complete expression defined in the variable, rather than the variable itself. DAX variables are immutable. Once they're assigned a value, they cannot be altered or reassigned within the same expression.
any new dax suggestion pls?
Just use the expression from the _count variable in CALCULATE after your RETURN statement.
I dont' get it, can you write the code?
Here you go
VAR _filter =
FILTER (
'Distinct - Master Data',
'Distinct - Master Data'[Category] = "NDPd"
&& ISBLANK ( 'Distinct - Master Data'[Site Creation(NDPd/IPM)] )
)
RETURN
CALCULATE ( COUNTROWS ( 'Distinct - Master Data' ), _filter )
COUNTROWS - counts the number of rows in a table
COUNT - Counts the number of rows in the table where the specified column has a non-blank value
if there are no blanks in Internal Site ID column, the result will be the same
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
86 | |
69 | |
66 | |
51 | |
32 |
User | Count |
---|---|
114 | |
99 | |
75 | |
65 | |
40 |