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
mudegowdrp
Helper II
Helper II

Previous Month should display 0 if there is no change

New count should zero for Jan month as there is no new items added.

 

Please see dataset and help me

 

I am getting output like this

Capture1.PNG

Here is my dataset and Expected result

Capture3.PNG

 

Measure looks like this.

 

NewApp = COUNTROWS (
    FILTER (
        ADDCOLUMNS (
            VALUES ( Sheet1[App Name] ),
            "PreviousApps", CALCULATE (
                COUNTROWS ( Sheet1 ),
                FILTER (
                    ALL ( 'Sheet1'[Date].[Date] ),
                    'Sheet1'[Date].[Date] < MIN ( 'Sheet1'[Date].[Date] )
                )
            )
        ),
     
    [PreviousApps] = 0
))

 

 

Please help.

1 ACCEPTED SOLUTION
nickchobotar
Skilled Sharer
Skilled Sharer

@mudegowdrp

 

 

Give this one a try.

 

NewAppsCol =  
VAR Test =
    COUNTROWS (
        FILTER (
            Table1,
            Table1[Date] <= EARLIER ( Table1[Date] )
                && Table1[AppName] = EARLIER ( Table1[AppName] )
       )
    )
RETURN
IF(Table1[Month] = "January", BLANK(),  IF ( Test > 1, BLANK (), Test ))


NewAppsCount = COUNT(Table1[NewAppsCol])

image.pngimage.png

View solution in original post

8 REPLIES 8
nickchobotar
Skilled Sharer
Skilled Sharer

@mudegowdrp

 

 

Give this one a try.

 

NewAppsCol =  
VAR Test =
    COUNTROWS (
        FILTER (
            Table1,
            Table1[Date] <= EARLIER ( Table1[Date] )
                && Table1[AppName] = EARLIER ( Table1[AppName] )
       )
    )
RETURN
IF(Table1[Month] = "January", BLANK(),  IF ( Test > 1, BLANK (), Test ))


NewAppsCount = COUNT(Table1[NewAppsCol])

image.pngimage.png

@nickchobotar it works. Thank you so much 🙂

Greg_Deckler
Super User
Super User

Can you explain in words what defines the criteria for a "New App"? I can't really understand the criteria you are going for from your measure formula.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Thank you for responding.

 

I need to buid a dashboard on Application Inventory dataset.

 

It has ID, Application Name and Date attribute.

 

What I need to show is new applications added month to month.

 

@Greg_Deckler Please see for more details. I need to show new Applications added month to month.

 

Ex: January Month has 3 Applications: a, b, c

     February has 2 new Applications: a,b,c,d,e

     March has 1 new Applications: a,b,c,d,e,f

     April has 0 new Applications: a,b,c,d,e,f

 

So my result table in power bi should give output as

 

Month           Application_Count           New_Application_Count

Jan                   3                                       0

Feb                  5                                       2

Jan                   6                                       1

Jan                   6                                       0

 

And When I click on February row

 

It should show

 

New Applications in February

d

e

 

 

 

 

I created a month table like:

 

Month, Num

Jan,1

Feb,2

Mar,3

Apr,4

 

My Apps table also included month short names, you could do this with a FORMAT or just get rid of the text-based month names and go with numeric using MONTH function. Related these two tables, then you can create calculated columns in Months table like so:

 

TotalApps = CALCULATE(COUNT(Apps[App]),FILTER(Apps,MONTH(Apps[Date])<=[Num]))

NewApps = VAR new = CALCULATE(COUNT(Apps[App]),FILTER(Apps,MONTH(Apps[Date])=[Num]))
RETURN IF(ISBLANK(new),0,new)

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler you are saying that Date Attribute in Apps table should be month number?

@nickchobotar by any chance did you delete your solution which you provided here?

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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