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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
chadg
Regular Visitor

Grouping records in table visual

I have a table visual in a report with a list of work items that are sorted by Job# and User Name. I am trying to create a lotting system for quality control that groups each set of work items into groups of 10.

 

I created the following dax code in a visual calculation to count to 10 and revert to 1, but it does not check if there are changes in the Job# or User Name column. My current work around is to use a slicer to select one job and user to prevent the numbering from not resetting when it is supposed to. I'm not currently doing anything to prevent each item from moving around other than sorting the visual by the date it was completed. Each item does have a sequential key in the background that could be used for this.

 

Calculation = 1

 

Calculation 1 = RUNNINGSUM([Calculation])

 

Weld Lot = SWITCH(CALCULATE(RIGHT(SUBSTITUTE(SELECTEDVALUE([Calculation 1]),".00",""),1),OFFSET(-1)), "1","2", "2","3", "3","4", "4","5", "5","6", "6","7", "7","8", "8","9", "9","10", "1")
 
The data in the visual should appear as below:
 
Work Item IDJob NumberUser NameCalculationCalculation 1Weld Lot
1491234John Doe1.001.001
6821234John Doe1.002.002
2501234Jack Smith1.003.001
8791234Jack Smith1.004.002
1239876John Doe1.005.001
4569876John Doe1.006.002
7895678Jane Doe1.007.001
8915678Jane Doe1.008.002
9025678Jane Doe1.009.003
1055678Jane Doe1.0010.004
1145678Jane Doe1.0011.005
125678Jane Doe1.0012.006
185678Jane Doe1.0013.007
48755678Jane Doe1.0014.008
1545678Jane Doe1.0015.009
6275678Jane Doe1.0016.0010
4355678Jane Doe1.0017.001
8905678Jane Doe1.0018.002

 

It currently looks like this:

 

Work Item IDJob NumberUser NameCalculationCalculation 1Weld Lot
1491234John Doe1.001.001
6821234John Doe1.002.002
2501234Jack Smith1.003.003
8791234Jack Smith1.004.004
1239876John Doe1.005.005
4569876John Doe1.006.006
7895678Jane Doe1.007.007
8915678Jane Doe1.008.008
9025678Jane Doe1.009.009
1055678Jane Doe1.0010.0010
1145678Jane Doe1.0011.001
125678Jane Doe1.0012.002
185678Jane Doe1.0013.003
48755678Jane Doe1.0014.004
1545678Jane Doe1.0015.005
6275678Jane Doe1.0016.006
4355678Jane Doe1.0017.007
8905678Jane Doe1.0018.008

 

The Weld Lot counting should reset under 3 conditions: change in Job#, change in user name, or previous weld lot = 10. 

 

I would also like to be able to export the data from the visual into excel, but visual calculations are a preview feature and they do not allow exporting. If there is a way around that, I would appreciate that as well.

 

Thank you for your help

1 ACCEPTED SOLUTION

Hi,

I have used a combination of Power Query and a DAC calculated column formula to solve the problem (though this can be solved in Power Query only as well).

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1726273164369.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Would you be OK with a calculated column formula solution?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur  Calculated columns are fine, thank you.

Hi,

I have used a combination of Power Query and a DAC calculated column formula to solve the problem (though this can be solved in Power Query only as well).

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1726273164369.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi, @chadg 

Based on your information, I create a sample table:

vyohuamsft_0-1726193432231.png

 

Then create calculated columns:

Calculation = 1
Calculation 1 = 
SUMX(
    FILTER(
        'Table',
        'Table'[Index] <= EARLIER('Table'[Index])
    ),
    'Table'[Calculation]
)
Weld Lot = 
VAR _Rank = RANKX(
    FILTER(
        'Table',
        'Table'[User Name] = EARLIER('Table'[User Name])
    ),
    'Table'[Index],
    ,
    ASC,
    DENSE
)
RETURN
    IF(
        ISBLANK(_Rank) || MOD(_Rank, 10) = 0,
        10,
       MOD(_Rank,10)
    
)

 

Here is my preview:

vyohuamsft_1-1726193756852.png

 

How to Get Your Question Answered Quickly

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@Anonymous Thank you for your help.

 

In your second picture, index 5 and 6 are given lot number 3 and 4. They should be 1 and 2 because the user name is the same, but the job number changed. Can you help with that?

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.