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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Amos_Lim
Resolver I
Resolver I

Find the different before sum up

I have a measure that pwerform sum up as shown.

.
I would like to have additional 2 measures:-

1) to calculate the difference between the values of these two dates before summing them up. i.e. this month values - last month values then perform the sum up.

2) to calculate how many values that was <>0 (<0 or >0) after finding the dfferent.

 

How can I achieve this? Thanks.

 

 

 

Sum QR-A = 
VAR Selected_Date = MAX(CalendarDate[Date])
VAR Previous_Date = CALCULATE(MAX(CalendarDate[Date]), PREVIOUSMONTH(CalendarDate[Date]))

VAR Sum_A = CALCULATE(
                    SUM('Raw Data'[Gradient-A]), 
                    FILTER(
                        'Raw Data',
                        NOT(
                            (
                                YEAR('Raw Data'[P-Date]) = YEAR(Selected_Date) && 
                                MONTH('Raw Data'[P-Date]) = MONTH(Selected_Date)
                            ) ||
                            (
                                YEAR('Raw Data'[R-Date]) = YEAR(Selected_Date) && 
                                MONTH('Raw Data'[R-Date]) = MONTH(Selected_Date)
                            ) ||
                            (
                                YEAR('Raw Data'[P-Date]) = YEAR(Previous_Date) && 
                                MONTH('Raw Data'[P-Date]) = MONTH(Previous_Date)
                            ) ||
                            (
                                YEAR('Raw Data'[R-Date]) = YEAR(Previous_Date) && 
                                MONTH('Raw Data'[R-Date]) = MONTH(Previous_Date)
                            )
                        )
                    )
                )

RETURN Sum_A + 0

 

 

3 REPLIES 3
v-nuoc-msft
Community Support
Community Support

Hi @Amos_Lim 

 

To help you better, please provide some dummy data as well as the expected results. Preferably in tabular form.

 

Regards,

Nono Chen

Please find the attached sample file.

The raw data sheet was imported into Power BI, and the expected result sheet contains my manual calculations.

The latest data within the same month was not included. For example, if a same A-set and C-No occur one or more times within the same month, only the data from the last date is used. Additionally, P-Date and R-Date data were excluded.

 

sample file

 

 

Not sure if this is achievable in PBI or power query?

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors
Top Kudoed Authors