Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi All,
Some context to start:
I am connected via direct query to a dataset so creating tables or calculated columns is not an option, as well as power query is not ethier.
I have the following measure which takes a date/time column and converts the date and time into an integer using a 24 hour clock format.
Example: Date/Time: 2/2/2022 7:07:01 AM Integer: 20220202070701
Hi Anonymous_226,
It sounds like you want to get the minimum Date/Time Integer for each unique number in the TableA[Number] column, and if there are multiple rows with the same Date/Time, you only want to keep one of those rows. You mentioned that one way to remove duplicates with the same Date/Time is to use the “stop” column, where one of the rows usually has a blank value and the other row has an actual Date/Time.
@Alef_Ricardo_yes that is correct I want to get the minimum Date/Time Integer for each unique number in the TableA[Number] column the issue with the measure that i posted above is that it is also not giving me the minimum Date/Time for each unique number for example i can see a number show up twice that both have the same date but one has a time of 07:07:15 and the other has a time of 07:07:16 and they both get returned by the measure
One way to achieve this is to create a new measure that filters out the rows with blank values in the “stop” column before calculating the minimum Date/Time Integer. Here’s an example of how you can do this:
MinDateTimeInteger =
VAR MinDateTime =
MINX (
SUMMARIZE (
FILTER ( TableA, NOT ( ISBLANK ( TableA[stop] ) ) ),
TableA[Number],
"MinStartInteger",
MINX (
FILTER ( TableA, TableA[Number] = EARLIER ( TableA[Number] ) ),
YEAR ( TableA[Date/Time] ) * 10000000000
+ MONTH ( TableA[Date/Time] ) * 100000000
+ DAY ( TableA[Date/Time] ) * 1000000
+ HOUR ( TableA[Date/Time] ) * 10000
+ MINUTE ( TableA[Date/Time] ) * 100
+ SECOND ( TableA[Date/Time] )
)
),
[MinStartInteger]
)
RETURN
MinDateTime
This measure first filters out the rows with blank values in the “stop” column using FILTER(TableA, NOT(ISBLANK(TableA[stop]))). Then it calculates the minimum Date/Time Integer for each unique number in the TableA[Number] column using the same logic as your original measure.
I hope this helps! Let me know if you have any further questions. 😊
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
11 | |
9 | |
6 |