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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
you7777
Frequent Visitor

How to show distinct strings month to month

I have a table that takes a snapshot of an environment of app labels every month. I want to be able to show the labels that were added or removed between one month to another. This is the query I have so far but its not working correctly. 

 

ChangedAppLabels =

VAR CurrentMonthLabels =
SELECTCOLUMNS(
CALCULATETABLE(
'Zylo Trending',
'Zylo Trending'[DB Loading Date]
),
"App Label", 'Zylo Trending'[App Label], "DB Loading Date", 'Zylo Trending'[DB Loading Date]
)

VAR PreviousMonthLabels =
SELECTCOLUMNS(
CALCULATETABLE(
'Zylo Trending',
PREVIOUSMONTH('DateTable'[Date])
),
"App Label", 'Zylo Trending'[App Label], "DB Loading Date", 'Zylo Trending'[DB Loading Date]
)

VAR AddedLabels =
EXCEPT(CurrentMonthLabels, PreviousMonthLabels)

VAR RemovedLabels =
EXCEPT(PreviousMonthLabels, CurrentMonthLabels)

RETURN
DISTINCT(
UNION(
SELECTCOLUMNS(AddedLabels, "Change Type", "Added", "App Label", [App Label], "DB Loading Date", [DB Loading Date]),
SELECTCOLUMNS(RemovedLabels, "Change Type", "Removed", "App Label", [App Label], "DB Loading Date", [DB Loading Date])
)
)
// DISTINCT(EXCEPT(DISTINCT(CurrentMonthLabels), DISTINCT( PreviousMonthLabels)))

4 REPLIES 4
Poojara_D12
Super User
Super User

Hi @you7777 

Can you please try below dax?

ChangedAppLabels =
VAR CurrentMonthLabels =
    SELECTCOLUMNS(
        FILTER(
            'Zylo Trending',
            'Zylo Trending'[DB Loading Date] = MAX('Zylo Trending'[DB Loading Date])
        ),
        "App Label", 'Zylo Trending'[App Label],
        "DB Loading Date", 'Zylo Trending'[DB Loading Date]
    )

VAR PreviousMonthLabels =
    SELECTCOLUMNS(
        FILTER(
            'Zylo Trending',
            'Zylo Trending'[DB Loading Date] = 
                EDATE(MAX('Zylo Trending'[DB Loading Date]), -1)
        ),
        "App Label", 'Zylo Trending'[App Label],
        "DB Loading Date", 'Zylo Trending'[DB Loading Date]
    )

VAR AddedLabels =
    EXCEPT(CurrentMonthLabels, PreviousMonthLabels)

VAR RemovedLabels =
    EXCEPT(PreviousMonthLabels, CurrentMonthLabels)

RETURN
    UNION(
        SELECTCOLUMNS(
            AddedLabels,
            "Change Type", "Added",
            "App Label", [App Label],
            "DB Loading Date", [DB Loading Date]
        ),
        SELECTCOLUMNS(
            RemovedLabels,
            "Change Type", "Removed",
            "App Label", [App Label],
            "DB Loading Date", [DB Loading Date]
        )
    )

 

 This revised query should correctly identify added or removed labels between snapshots.

 

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Poojara
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS 

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS

So this only returned the last 2 months, and it returned all the apps (i just turned it into a count for better understanding). Rather, I need just the labels that are different between each month to be returned, on a month to month basis, ideally showing what was added and what was removed. In this case, it should just show 10 labels for the month of december. 

 

Screenshot 2024-12-20 at 10.28.18 AM.png

Anonymous
Not applicable

Hi @you7777 

We are unable to provide you with complete advice based on the information you provided, can you provide some sample data (hide the private message)  and the output you want so that can provide more suggestion for you.

 

Best Regards!

Yolo Zhu

this was the output of my original query. Again, these are string labels but i've turned them into a count for a quick summary/data privacy. I want to be able to show which labels are different month to month. If possible - I'd also like to show which labels were added and which ones were removed.

 

Screenshot 2024-12-20 at 10.40.29 AM.png

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.