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.
Hi Experts,
I would like to count a specific year date and month in a column. I'm using IF condition or statement to do that.
Let says I want to count date data for 2020, 2019 and the blank data. In this case i create a column with conditions IF like below to get status for "Returned". It should count 2877
Solved! Go to Solution.
Hi, @Zaky
Depending on your needs, the following Measure is recommended:
Measure =
var a =
CALCULATE(
COUNTROWS('Data2020'),
IF(
YEAR('Data2020'[Batch Return])=2019 || YEAR('Data2020'[Batch Return])=BLANK(),1,0)
)
var b=
CALCULATE(
COUNTROWS('Data2020'),
FILTER(
Data2020,
((Data2020[Batch Return].[MonthNo])=1||(Data2020[Batch Return].[MonthNo])=2)&&YEAR(Data2020[Batch Return])=2020)
)
return
a+b
The result is as follows:
Here is the sample file that you can refer:
Best Regards,
Link Chen
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Zaky
Depending on your needs, the following Measure is recommended:
Measure =
var a =
CALCULATE(
COUNTROWS('Data2020'),
IF(
YEAR('Data2020'[Batch Return])=2019 || YEAR('Data2020'[Batch Return])=BLANK(),1,0)
)
var b=
CALCULATE(
COUNTROWS('Data2020'),
FILTER(
Data2020,
((Data2020[Batch Return].[MonthNo])=1||(Data2020[Batch Return].[MonthNo])=2)&&YEAR(Data2020[Batch Return])=2020)
)
return
a+b
The result is as follows:
Here is the sample file that you can refer:
Best Regards,
Link Chen
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
@Zaky , Create a measure like
#RETURNED2019and2020andBLANK = CALCULATE(COUNTROWS('Data2020'), filter('Data2020', YEAR('Data2020'[Batch Return]) in {2019, 2020} || isblank('Data2020'[Batch Return])))
Dear @amitchandak ,
What if i just want to count month of January and February only for 2020 without excluding year 2019 and Blank value?
For better understanding:
1) Count all in year 2019
2) Count only selected month (January and February) in year 2020
3) Count all for blank value.
Thanks again
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 |
---|---|
108 | |
98 | |
78 | |
66 | |
53 |
User | Count |
---|---|
139 | |
100 | |
95 | |
85 | |
63 |