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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
SachinNamdeo-20
Helper II
Helper II

New dealer count

"How i can calculate new dealer  count
new dealer condition is simple a dealer present in current month and sale some item but not present just one month before and not sale any item
 I have this type of data Table  - Cube invoice,in which dealer and sales are respectively"

datemonthmonthnodealersales
01-01-22jan1a,b,c,d10,020,20,300,
02-02-22feb2a,b,c,d,e,f10,20,30,25,05,30
01-03-22march3g,h,i,j,a,b,c11,12,15,14,18,151,15

I want this kind measure which can give me value if i select feb month in calender slicer it gives me return value  2 beacause there is 2 new dealer that is e & f similarly 

march give - 4



1 ACCEPTED SOLUTION

Hi,

Thank you for your feedback.

I do not know how your desired visualization looks like, but please check the below picture and the attached pbix file whether it suits your requirement.

 

Jihwan_Kim_0-1671610818482.png

 

 

New dealer count: =
VAR _currentmonthdealerlist =
    SUMMARIZE ( Data, Dealer[dealer] )
VAR _prevmonthsdealierlist =
    CALCULATETABLE (
        SUMMARIZE ( Data, Dealer[dealer] ),
        WINDOW (
            1,
            ABS,
            -1,
            REL,
            ALL ( 'Calendar'[Month-Year sort], 'Calendar'[Month-Year] ),
            ORDERBY ( 'Calendar'[Month-Year sort] )
        )
    )
VAR _newdealerlist =
    EXCEPT ( _currentmonthdealerlist, _prevmonthsdealierlist )
RETURN
    COUNTROWS ( _newdealerlist )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your datamodel looks like, but I tried to create a sample pbix file like below.

I transformed the fact table like below in Power Query Editor.

Please check the below picture and the attached pbix file.

I hope the below can provide some ideas on how to create a solution for your datamodel.

 

Jihwan_Kim_0-1671602886782.pngJihwan_Kim_1-1671602905994.png

 

Jihwan_Kim_2-1671603085830.png

 

 

 

New dealer count: =
VAR _currentmonthdealerlist =
    SUMMARIZE ( Data, Dealer[dealer] )
VAR _prevmonthdealierlist =
    CALCULATETABLE (
        SUMMARIZE ( Data, Dealer[dealer] ),
        DATEADD ( 'Calendar'[Date], -1, MONTH )
    )
VAR _newdealerlist =
    EXCEPT ( _currentmonthdealerlist, _prevmonthdealierlist )
RETURN
    COUNTROWS ( _newdealerlist )

 

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

THANK YOU SIR FOR VALUEABLE SUGGESTION BUT, 
this measure gives me blank value
Sorry to say that ,i forgot the main condition which is that new dealer is only considerd when he have sale any particular month which i select ,this measure only gives the value which dealer were not on previous month

Hi,

Thank you for your feedback.

I do not know how your desired visualization looks like, but please check the below picture and the attached pbix file whether it suits your requirement.

 

Jihwan_Kim_0-1671610818482.png

 

 

New dealer count: =
VAR _currentmonthdealerlist =
    SUMMARIZE ( Data, Dealer[dealer] )
VAR _prevmonthsdealierlist =
    CALCULATETABLE (
        SUMMARIZE ( Data, Dealer[dealer] ),
        WINDOW (
            1,
            ABS,
            -1,
            REL,
            ALL ( 'Calendar'[Month-Year sort], 'Calendar'[Month-Year] ),
            ORDERBY ( 'Calendar'[Month-Year sort] )
        )
    )
VAR _newdealerlist =
    EXCEPT ( _currentmonthdealerlist, _prevmonthsdealierlist )
RETURN
    COUNTROWS ( _newdealerlist )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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