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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Cumulative unique count based on sales values-DAX

Hi expert,

 

I am stucking on to calculate cumulative unique count in DAX month on month basis some criteria,

please help me to get this done.

Thanks a ton in advance.

@Icey @Tanushree_Kapse @VahidDM @Anonymous @amitchandak @pbig @administrator @PBICommunity @PBCommunity 

Raw data and summary below.

shankarshiva70_0-1636956704783.png

Please help me on this.

Thanks

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks VahidDM.

Basis on your logic , I have added on other criteria basis my data and  have applied in my project is working . Got what I was looking for.

 

Dist_Count_Retailer_for_repeat_Analysis  = calculate(DISTINCTCOUNT('db_CSA_Data Yield_Sec_Test'[Distributor+finalvittrackcode]),FILTER(SUMMARIZE('db_CSA_Data Yield_Sec_Test','db_CSA_Data Yield_Sec_Test'[Distributor+finalvittrackcode],Dates[CalYear],Dates[MOC_Name_Auto_New],'db_CSA_Data Yield_Sec_Test'[Pri_Sec],'db_CSA_Data Yield_Sec_Test'[DistributorCode],SAP_CSA_Tbl_Customer_Master[DB Name],SAP_CSA_Tbl_Customer_Master[State_Mapping.Region-Group],SAP_CSA_Tbl_Customer_Master[State_Mapping.State Group],SAP_CSA_Tbl_Customer_Master[City name],'Channel_Index Final'[Final Channel],Dates[MOC_Code_Auto_New for repeat],"Sum of Qty",SUM('db_CSA_Data Yield_Sec_Test'[Quantity]),"Sum of Yield",SUM('db_CSA_Data Yield_Sec_Test'[Actualyield])),[Sum of Qty]<>0&&'db_CSA_Data Yield_Sec_Test'[Pri_Sec]="Sec inc P=S"))
 
Thanks.

View solution in original post

4 REPLIES 4
VahidDM
Super User
Super User

Hi @Anonymous 

 

Try this measure:

 

 

Measure1 = 
VAR _A =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Cust] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Months] < MAX ( 'Table'[Months] )
                && 'Table'[sales flag] = 1
        )
    )
RETURN
    IF ( ISBLANK ( _A ), 0, _A )

 

 

output:

VahidDM_1-1636957374309.png

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

 

Anonymous
Not applicable

Thank u so much for quick reply and looking correct . but while applying in my live data , not getting correct output

Sorry My data is at invoice level hence one customer can have mulitple records basis on their billing in same month but have to check the sales at customer level while counting in month.

like base raw data will be.

output will be same

shankarshiva70_0-1636962861793.png

 

Anonymous
Not applicable

Thanks VahidDM.

Basis on your logic , I have added on other criteria basis my data and  have applied in my project is working . Got what I was looking for.

 

Dist_Count_Retailer_for_repeat_Analysis  = calculate(DISTINCTCOUNT('db_CSA_Data Yield_Sec_Test'[Distributor+finalvittrackcode]),FILTER(SUMMARIZE('db_CSA_Data Yield_Sec_Test','db_CSA_Data Yield_Sec_Test'[Distributor+finalvittrackcode],Dates[CalYear],Dates[MOC_Name_Auto_New],'db_CSA_Data Yield_Sec_Test'[Pri_Sec],'db_CSA_Data Yield_Sec_Test'[DistributorCode],SAP_CSA_Tbl_Customer_Master[DB Name],SAP_CSA_Tbl_Customer_Master[State_Mapping.Region-Group],SAP_CSA_Tbl_Customer_Master[State_Mapping.State Group],SAP_CSA_Tbl_Customer_Master[City name],'Channel_Index Final'[Final Channel],Dates[MOC_Code_Auto_New for repeat],"Sum of Qty",SUM('db_CSA_Data Yield_Sec_Test'[Quantity]),"Sum of Yield",SUM('db_CSA_Data Yield_Sec_Test'[Actualyield])),[Sum of Qty]<>0&&'db_CSA_Data Yield_Sec_Test'[Pri_Sec]="Sec inc P=S"))
 
Thanks.
Anonymous
Not applicable

Thanks VahidDM.

Basis on your logic , I have added on other criteria basis my data and  have applied in my project is working . Got what I was looking for.

 

Dist_Count_Retailer_for_repeat_Analysis  = calculate(DISTINCTCOUNT('db_CSA_Data Yield_Sec_Test'[Distributor+finalvittrackcode]),FILTER(SUMMARIZE('db_CSA_Data Yield_Sec_Test','db_CSA_Data Yield_Sec_Test'[Distributor+finalvittrackcode],Dates[CalYear],Dates[MOC_Name_Auto_New],'db_CSA_Data Yield_Sec_Test'[Pri_Sec],'db_CSA_Data Yield_Sec_Test'[DistributorCode],SAP_CSA_Tbl_Customer_Master[DB Name],SAP_CSA_Tbl_Customer_Master[State_Mapping.Region-Group],SAP_CSA_Tbl_Customer_Master[State_Mapping.State Group],SAP_CSA_Tbl_Customer_Master[City name],'Channel_Index Final'[Final Channel],Dates[MOC_Code_Auto_New for repeat],"Sum of Qty",SUM('db_CSA_Data Yield_Sec_Test'[Quantity]),"Sum of Yield",SUM('db_CSA_Data Yield_Sec_Test'[Actualyield])),[Sum of Qty]<>0&&'db_CSA_Data Yield_Sec_Test'[Pri_Sec]="Sec inc P=S"))
 
Thanks.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors