Forum Discussion

tgraves's avatar
tgraves
Regular Visitor
3 years ago
Solved

Reset Counter

I have a report where I have 3 tables, the tables are lined up side by side.  

 

Each table only shows results for the corresponding number.  Table 1 = Number 1, etc.

 

Each table has a name and a picture

 

Table 1Table 1 Table 2Table 2 Table 3Table 3
        
        

 

In the table 

NameImgNumber
Johnimage1.jpg1
Joe image2.jpg2
Sam image3.jpg3
Jake image4.jpg1
Michelle image5.jpg2
   

In sql I can do row number and have it restart number at 3.  But the numbers don't update when you filter in powerbi.

 

I need to do the same thing in powerbi so that it is dynamic.  So if I filter on location it removes the users and updates the number.

 

I feel like this should be something simple but I am not having any luck.  

  • Hi tgraves ,

     

    Please try:

    First unpivot the table:

    Then use this table to create a slicer

    Apply the measrue:

    Number = 
    var _a = LEFT(MAX('Table (2)'[Img]),LEN(MAX('Table (2)'[Img]))-4)
    var _b = RIGHT(_a,LEN(_a)-5)
    var _c = COUNTROWS('Table (3)')
    var _d = MOD(_b,_c)
    return IF(_d=0,_c,MOD(_b,_c))

    Final output:

    Best Regards,

    Jianbo Li

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

1 Reply

  • Hi tgraves ,

     

    Please try:

    First unpivot the table:

    Then use this table to create a slicer

    Apply the measrue:

    Number = 
    var _a = LEFT(MAX('Table (2)'[Img]),LEN(MAX('Table (2)'[Img]))-4)
    var _b = RIGHT(_a,LEN(_a)-5)
    var _c = COUNTROWS('Table (3)')
    var _d = MOD(_b,_c)
    return IF(_d=0,_c,MOD(_b,_c))

    Final output:

    Best Regards,

    Jianbo Li

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