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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
aditi1997yadav
Frequent Visitor

MOM not reacting as it should

i am using this dax to find the previous 3 month volume change according to selection in filter , but instead of giving me 3 bars for the 3 months it is giving me multiple bars for same month. can anyone help me solve this please: 
 
this is how it is coming and the below is how i want:
 
Last3MonthNegative_Summarized =
VAR MaxDate_ = MAX('cat_subcat'[FINAL_FEEDBACK_DATE])  -- Get the latest selected date
VAR LastPeriod_ =
    DATESINPERIOD(
        'daterangetable'[date],
        MaxDate_,
        -3,
        MONTH
    )
RETURN
    CALCULATE(
        COUNT(cat_subcat[NEG_SENTIMENT]),  
        REMOVEFILTERS(cat_subcat),  
        KEEPFILTERS(LastPeriod_), 
        USERELATIONSHIP(
            cat_subcat[date copy],
            Calendar_auto[Date]  
        ),
        VALUES(cat_subcat[Category])
    )
1 ACCEPTED SOLUTION
Bibiano_Geraldo
Super User
Super User

Hi @aditi1997yadav ,

please try this DAX:

Last3MonthNegative_Summarized =
VAR MaxDate_ = MAX('cat_subcat'[FINAL_FEEDBACK_DATE])  -- Get the latest selected date
VAR LastPeriod_ =
    DATESINPERIOD(
        'daterangetable'[date],
        MaxDate_,
        -3,
        MONTH
    )
RETURN
    CALCULATE(
        COUNT(cat_subcat[NEG_SENTIMENT]),  
        REMOVEFILTERS(cat_subcat),  
        KEEPFILTERS(LastPeriod_),
        USERELATIONSHIP(
            cat_subcat[date copy],
            Calendar_auto[Date]
        )
    )

View solution in original post

2 REPLIES 2
Bibiano_Geraldo
Super User
Super User

Hi @aditi1997yadav ,

please try this DAX:

Last3MonthNegative_Summarized =
VAR MaxDate_ = MAX('cat_subcat'[FINAL_FEEDBACK_DATE])  -- Get the latest selected date
VAR LastPeriod_ =
    DATESINPERIOD(
        'daterangetable'[date],
        MaxDate_,
        -3,
        MONTH
    )
RETURN
    CALCULATE(
        COUNT(cat_subcat[NEG_SENTIMENT]),  
        REMOVEFILTERS(cat_subcat),  
        KEEPFILTERS(LastPeriod_),
        USERELATIONSHIP(
            cat_subcat[date copy],
            Calendar_auto[Date]
        )
    )
lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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