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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors