Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi, using the dog kennel table below, I'm looking for a column/measure that when the End date is blank, it gives me the last date of the month that we are currently in, and puts the number count in Numbe_of_Days_Open, please. Thanks!
Location | Kennel | Start Date | End Date | Number of Days |
Manchester | 1 | 01/04/2024 | 10/04/2024 | 10 |
Manchester | 1 | 01/06/2024 | 14/06/2024 | 14 |
Manchester | 1 | 28/11/2024 |
Solved! Go to Solution.
Hi @RichOB ,
Try below DAX to create a measure:
Thanks for the reply from AnkitaaMishra , please allow me to provide another insight:
Hi, @RichOB
AnkitaaMishra 's solution is a good idea for measures.Now, I will provide a solution for calculated columns:
1.Firstly, you need to create the following two calculated columns:
end1 =
IF ( ISBLANK ( 'Table'[End Date] ), EOMONTH ( TODAY (), 0 ), 'Table'[End Date] )
Number of Days1 =
IF (
ISBLANK ( 'Table'[End Date] ),
DATEDIFF ( 'Table'[Start Date], EOMONTH ( TODAY (), 0 ), DAY ) + 1,
DATEDIFF ( 'Table'[Start Date], 'Table'[End Date], DAY ) + 1
)
2.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for the reply from AnkitaaMishra , please allow me to provide another insight:
Hi, @RichOB
AnkitaaMishra 's solution is a good idea for measures.Now, I will provide a solution for calculated columns:
1.Firstly, you need to create the following two calculated columns:
end1 =
IF ( ISBLANK ( 'Table'[End Date] ), EOMONTH ( TODAY (), 0 ), 'Table'[End Date] )
Number of Days1 =
IF (
ISBLANK ( 'Table'[End Date] ),
DATEDIFF ( 'Table'[Start Date], EOMONTH ( TODAY (), 0 ), DAY ) + 1,
DATEDIFF ( 'Table'[Start Date], 'Table'[End Date], DAY ) + 1
)
2.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @RichOB ,
Try below DAX to create a measure:
User | Count |
---|---|
84 | |
76 | |
75 | |
43 | |
36 |
User | Count |
---|---|
109 | |
56 | |
52 | |
48 | |
43 |