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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Zaibsrule88
Frequent Visitor

what if date is same

I'm new on PBI, working on a report where Ive to show QTY for a user for specific day - Problem is if user go out twice or more Ive to show only assign QTY.

 

DateNameAssigned QTY 
8/27/2022JOHN35
8/27/2022JOLYY35
8/27/2022JOHN35
  105

 

This is what I need

DateNameAssigned QTY 
8/27/2022JOHN35
8/27/2022JOLYY35
8/27/2022JOHN 
  70

 

2 ACCEPTED SOLUTIONS

@littlemojopuppy , have you created a messure called AssignedQTY and remove duplicates in that measure? If you simply sum up AssignedQTY, that won't remove the duplicates. To remove the duplicate, you need to

 

1. in the fact table, create a new column to calculate the number of times a name appearing on a specific day. If a name appear twice on the same day, column duplicate count will generate 2.

2. create a measure to make sure if a name appear more than once on the same day, the total QTY should be divided by duplicate count. Below is the table showing the correct QTY.

duplicate check.PNG

duplicate check2.PNG

View solution in original post

v-cgao-msft
Community Support
Community Support

Hi @Zaibsrule88 

 

Please new a measure.

 

Total =
VAR _table =
    SUMMARIZE ( 'Table', 'Table'[Code], 'Table'[Date], 'Table'[AvailableCap] )
VAR _total =
    SUMX ( _table, 'Table'[AvailableCap] )
RETURN
    _total

 

vcgaomsft_0-1661828902091.png

The PBIX file is attached for reference.

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

10 REPLIES 10
v-cgao-msft
Community Support
Community Support

Hi @Zaibsrule88 

 

Please new a measure.

 

Total =
VAR _table =
    SUMMARIZE ( 'Table', 'Table'[Code], 'Table'[Date], 'Table'[AvailableCap] )
VAR _total =
    SUMX ( _table, 'Table'[AvailableCap] )
RETURN
    _total

 

vcgaomsft_0-1661828902091.png

The PBIX file is attached for reference.

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Thank you @v-cgao-msft 

 

It solves the issue.

 

Thank you 

Jeanxyz
Post Prodigy
Post Prodigy

@Zaibsrule88 

Correct me if I get you wrong. In your original table (e.g., fact_QTY ) duplicate recored are created because a new record is generated each time a user goes out or moves. To remove duplicate records, you can create a summary table as below. 

fact_QTY_summarize=summarize(fact_QTY,  fact_QTY[Date], fact_QTY[NameAssigned QTY])

 

Thank you for your help.

 

Correct , each time user goes out or move system creates a new record with new code with fixed QTY.

 

best way is count the duplicates, based on dates and devide the fixed Qty on Count.

 

 

Thank you

@Jeanxyz it's not a good idea to start creating tables to support individuial visualizations.  Create a nice, clean star/snowflake design and write measures appropriately.

 

I'm also thinking there needs to be some thought about repeating ABC twice in the same day in a visualization.

littlemojopuppy
Community Champion
Community Champion

Hi @Zaibsrule88.  Define a measure for Total QTY = SUM(AssignedQTY).  On a matrix visual, drop date and name in rows and the measure Total QTY for values.

 

There's no need to alter the underlying table for this.  Hope this helps!

@littlemojopuppy , have you created a messure called AssignedQTY and remove duplicates in that measure? If you simply sum up AssignedQTY, that won't remove the duplicates. To remove the duplicate, you need to

 

1. in the fact table, create a new column to calculate the number of times a name appearing on a specific day. If a name appear twice on the same day, column duplicate count will generate 2.

2. create a measure to make sure if a name appear more than once on the same day, the total QTY should be divided by duplicate count. Below is the table showing the correct QTY.

duplicate check.PNG

duplicate check2.PNG

First of all Thank you for your response and really appriciate it,

I will try to explain the issue in more detail/

I have to assign a fixed target to each member " lets say forty"

sometimes name appears twice in a date and the problem is I dont have to remove it , I want build a way that if name appears twice in a day I assign a fixed value to that particular name only once,

 

lets say 

 

abc 40

xyz  40 

abc "Repeated" "Should be 0 " because its repeated twice in same day

 

 

@Zaibsrule88 I don't believe you should have to alter data to achieve this.  It sounds like the kind of thing that could be handled in a visual or in how a measure is defined.  Can you provide some sample data to play with?

  I want sum to be 55 and 65 if code and date is same

Zaibsrule88_0-1661777528916.png

Zaibsrule88_1-1661777588805.png

 

 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.