The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 |
---|---|
28 | |
12 | |
8 | |
7 | |
5 |
User | Count |
---|---|
36 | |
14 | |
12 | |
7 | |
7 |