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.
Hi,
Can anyone help me achieve the below?
I have these columns in PBi:
Case | Latest comment date | Case type
1 | 03-18-2022 09:56:36 AM | A
2 | 03-19-2022 15:35:23 PM | B
3 | 03-21-2022 20:31:05 PM | C
For case type A I would like to calculate how many hours have passed since the comment was placed till now.
For case type B and C I would like to calculate how many days have passed since the comment was placed till now.
Case | Latest comment date | Case type | Passed
1 | 03-18-2022 09:56:36 AM | A | 80 hours
2 | 03-19-2022 15:35:23 PM | B | 2 days
3 | 03-20-2022 20:31:05 PM | C | 1 day
Appreciate your help!
Solved! Go to Solution.
You could add a calculated column as
Passed =
IF( 'Table'[Case type] = "A", DATEDIFF( 'Table'[Latest comment date], NOW(), HOUR) & " hours",
DATEDIFF( 'Table'[Case type], NOW(), DAY) & " days"
)
or if you want to put it in a measure you would need to wrap the column references in SELECTEDVALUES functions
Thank you John!
You could add a calculated column as
Passed =
IF( 'Table'[Case type] = "A", DATEDIFF( 'Table'[Latest comment date], NOW(), HOUR) & " hours",
DATEDIFF( 'Table'[Case type], NOW(), DAY) & " days"
)
or if you want to put it in a measure you would need to wrap the column references in SELECTEDVALUES functions
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 |
---|---|
75 | |
68 | |
54 | |
37 | |
35 |
User | Count |
---|---|
66 | |
66 | |
59 | |
53 | |
45 |