So I have two columns: "Start date" and "End date" Some cells in the columns, however, are blank. So, I want to create 3 columns that add a "1" in the their respective cells based on the following conditions:
Column One: If row has a start date and end date, then add a "1"
Column Two: If row has a start date and no end date, then add a "1"
Column Three: If row has no start date and no end date, then add a "1"
Reason I want three columns is because then I'll add up those 1s to display the number of rows that fall under each category.
Solved! Go to Solution.
Hi @pintobean87
You can do this with measures. Usually best to use measures when you can rather than create unnecessary columns in your data set.
Start Date and End Date = CALCULATE(COUNTROWS('DataTable'), FILTER('DataTable', NOT ISBLANK('DataTable'[End Date]) && NOT ISBLANK('DataTable'[Start Date])))
No End Date = CALCULATE(COUNTROWS('DataTable'), FILTER('DataTable', ISBLANK('DataTable'[End Date]) && NOT ISBLANK('DataTable'[Start Date])))
No Start Date and No End Date = CALCULATE(COUNTROWS('DataTable'), FILTER('DataTable', ISBLANK('DataTable'[End Date]) && ISBLANK('DataTable'[Start Date])))
Regards
Phil
Proud to be a Super User!
Hi @pintobean87,
Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.
If these also don't help, please share more detailed information to help us clarify your scenario to test.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
Hi @pintobean87
You can do this with measures. Usually best to use measures when you can rather than create unnecessary columns in your data set.
Start Date and End Date = CALCULATE(COUNTROWS('DataTable'), FILTER('DataTable', NOT ISBLANK('DataTable'[End Date]) && NOT ISBLANK('DataTable'[Start Date])))
No End Date = CALCULATE(COUNTROWS('DataTable'), FILTER('DataTable', ISBLANK('DataTable'[End Date]) && NOT ISBLANK('DataTable'[Start Date])))
No Start Date and No End Date = CALCULATE(COUNTROWS('DataTable'), FILTER('DataTable', ISBLANK('DataTable'[End Date]) && ISBLANK('DataTable'[Start Date])))
Regards
Phil
Proud to be a Super User!
Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.
Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!
Join the biggest FREE Business Applications Event in LATAM this February.
User | Count |
---|---|
210 | |
49 | |
45 | |
44 | |
42 |
User | Count |
---|---|
262 | |
211 | |
103 | |
79 | |
65 |