Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
ohqpi
New Member

Create unique IDs to group same values by date

Hi all, 

 

I am using a data set that has been added using import mode, so I am unable to use the Advance Editor to manipulate the data. Basically, my data set has some IDs that have varying volumes accross different days. What I'd like to is make a unique ID for group of dates that have the same volume. For example: 

IDDateVolume
1111/1/2025700
1112/1/20250
1113/1/20250
1114/1/20250
1115/1/2025200
1116/1/2025200
2221/1/202550
2222/1/2025100
2223/1/2025100
2224/1/2025100
2225/1/2025500
2226/1/2025500
3331/1/2025100
3332/1/2025200
3333/1/2025200
3334/1/2025200
3335/1/2025500
3336/1/2025500

 

And what I would ideally love to see is:

IDStart DateEnd DateSum of Volume
111.v11/1/20251/1/2025700
111.v22/1/20254/1/20250
111.v35/1/20256/1/2025400
222.v11/1/20251/1/202550
222.v22/1/20254/1/2025300
222.v35/1/20256/1/20251000
333.v11/1/20251/1/2025100
333.v22/1/20254/1/2025600
333.v35/1/20256/1/2025

1000

 

I know it is easy to do in Advanced Editor, but would it be possible at all in DAX? 

 

Thank you!!

1 ACCEPTED SOLUTION
speedramps
Super User
Super User

Click here to download a solution from Onedrive
Click here 

 

How it works ....

Create a table with your test data

speedramps_2-1749733968519.png

 

Group it

speedramps_3-1749734001187.png

 

 

Group it again

speedramps_4-1749734035891.png

Add a custom column

speedramps_5-1749734062671.png

speedramps_6-1749734069901.png

Remove all columns except the custom column

speedramps_7-1749734109089.png

 

Expand the column

speedramps_8-1749734129954.png

 

Add a customer column

speedramps_9-1749734158641.png

 

Remove the unneeded columns and reorder  columns

 

Please click [thumbs up]  because I hace tried really hard.

And click [accept solution] it it works  .... it clearly does work.
Thank you 😀

 

 

 

View solution in original post

5 REPLIES 5
v-aatheeque
Community Support
Community Support

Hi @ohqpi ,

If the response addressed by @speedramps  @burakkaragoz helped resolve your issue, it would be greatly appreciated if you could mark it as the Accepted Answer  doing so helps others in the community who may be facing a similar challenge.

If you still have questions or need further assistance, feel free to share more details — we’re always here to support you.

 

Thanks again for being an active part of the Microsoft Fabric Community!

Hi @ohqpi 

If the response from @speedramps or @burakkaragoz was helpful in resolving your issue, we would greatly appreciate it if you could mark it as the Accepted Answer. This not only assists you but also aids others in the community who might be encountering similar challenges.

Should you have any further questions or require additional assistance, please don’t hesitate to provide more details. We’re always here to help!

Thank you for being an engaged member of the Microsoft Fabric Community!

 

 

Hi @ohqpi 

Thank you for your question! I understand that you're looking to create a unique ID for groups of dates that share the same volume in your imported dataset. However, since you're using Import mode, you won't have access to the Advanced Editor to manipulate the data directly.

If the above question is resolved your query accept the solution.
If you have any further questions, feel free to reach out.

 

Thank you for being a valued member of the Microsoft Fabric Community Forum!

speedramps
Super User
Super User

Click here to download a solution from Onedrive
Click here 

 

How it works ....

Create a table with your test data

speedramps_2-1749733968519.png

 

Group it

speedramps_3-1749734001187.png

 

 

Group it again

speedramps_4-1749734035891.png

Add a custom column

speedramps_5-1749734062671.png

speedramps_6-1749734069901.png

Remove all columns except the custom column

speedramps_7-1749734109089.png

 

Expand the column

speedramps_8-1749734129954.png

 

Add a customer column

speedramps_9-1749734158641.png

 

Remove the unneeded columns and reorder  columns

 

Please click [thumbs up]  because I hace tried really hard.

And click [accept solution] it it works  .... it clearly does work.
Thank you 😀

 

 

 

burakkaragoz
Super User
Super User

Hi @ohqpi ,

Yes, you can approach this in DAX, but it requires a few calculated columns and measures since DAX does not offer row-by-row transformation like Power Query’s Advanced Editor. Here’s a way you can achieve similar results:

Step 1: Create a grouping key

First, create a calculated column to identify groups where the same ID has the same Volume across consecutive dates.
You’ll need to compare each row with the previous row for the same ID to detect where a new group starts.

DAX
 
GroupKey =
VAR PrevVolume =
    CALCULATE(
        MAX('YourTable'[Volume]),
        FILTER(
            'YourTable',
            'YourTable'[ID] = EARLIER('YourTable'[ID]) &&
            'YourTable'[Date] = EARLIER('YourTable'[Date]) - 1
        )
    )
VAR NewGroup =
    IF(
        'YourTable'[Volume] <> PrevVolume || ISBLANK(PrevVolume),
        1, 0
    )
VAR GroupNumber =
    CALCULATE(
        SUMX(
            FILTER(
                'YourTable',
                'YourTable'[ID] = EARLIER('YourTable'[ID]) &&
                'YourTable'[Date] <= EARLIER('YourTable'[Date])
            ),
            IF(
                'YourTable'[Volume] <> 
                CALCULATE(
                    MAX('YourTable'[Volume]),
                    FILTER(
                        'YourTable',
                        'YourTable'[ID] = EARLIER('YourTable'[ID]) &&
                        'YourTable'[Date] = EARLIER('YourTable'[Date]) - 1
                    )
                ) || ISBLANK(
                    CALCULATE(
                        MAX('YourTable'[Volume]),
                        FILTER(
                            'YourTable',
                            'YourTable'[ID] = EARLIER('YourTable'[ID]) &&
                            'YourTable'[Date] = EARLIER('YourTable'[Date]) - 1
                        )
                    )
                ),
                1, 0
            )
        )
    )
RETURN
    'YourTable'[ID] & "-" & GroupNumber

Step 2: Calculate Start Date, End Date, and Sum of Volume

Now you can aggregate by this GroupKey:

  • Start Date: MIN(Date) for each GroupKey
  • End Date: MAX(Date) for each GroupKey
  • Sum of Volume: SUM(Volume) for each GroupKey

You can do this either in a summary table or via measures in your visual.

Example Summary Table:

DAX
 
SummaryTable =
SUMMARIZE(
    'YourTable',
    [GroupKey],
    "ID", MAX('YourTable'[ID]),
    "Start Date", MIN('YourTable'[Date]),
    "End Date", MAX('YourTable'[Date]),
    "Sum of Volume", SUM('YourTable'[Volume])
)

Note:

  • You may need to adjust the date comparison logic if your dates are not consecutive or are not integers.
  • If your [Date] column is text, you’ll need to convert it to a Date type.
  • This approach works in import mode and is fully DAX-based.

Let me know if you need help adapting the logic to your exact table or date format!
translation and formatting supported by AI

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.