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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
DeEviloN
Helper III
Helper III

Block difference

Good afternoon! I use the formula to get the difference between the current quarter and the last 

TOTALQTD(SUM('Свод 21'[Количество изделий всего,шт]),'Свод 21'[Датавыдачи])-CALCULATE(TOTALQTD(SUM('Свод 21'[Количество изделий всего,шт]),'Свод 21'[Датавыдачи]),DATEADD('календарь'[Date],-1,QUARTER))

 

DeEviloN_0-1653464856577.png

discovered that the formula in the 1st quarter subtracts from the 4th quarter of the same year, help me figure out if it is possible to set the conditions under which it will give out 0 if it is 1 quarter?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @DeEviloN ,

 

Please check you data model. Here I create a sample to have a test.

Summary 21:

RicoZhou_0-1653880001634.png

calendar:

calendar =
ADDCOLUMNS (
    CALENDARAUTO (),
    "Year", YEAR ( [Date] ),
    "Qtr",
        "Qtr" & " "
            & QUARTER ( [Date] )
)

Relationship:

RicoZhou_1-1653880042959.png

You can try this measure to get result.

Diff between Current Qtr and Last Qtr = 
VAR _SUMMARIZE =
    SUMMARIZE (
        'calendar',
        'calendar'[Qtr],
        "DIFF",
            VAR _DIFF =
                TOTALQTD ( SUM ( 'Summary 21'[Number of items total,pcs] ), 'Summary 21'[Date] )
                    - CALCULATE (
                        TOTALQTD ( SUM ( 'Summary 21'[Number of items total,pcs] ), 'Summary 21'[Date] ),
                        DATEADD ( 'calendar'[Date], -1, QUARTER )
                    )
            RETURN
                IF ( 'calendar'[Qtr] = "Qtr 1", 0, _DIFF )
    )
RETURN
    SUMX ( _SUMMARIZE, [DIFF] )

Result is as below.

RicoZhou_2-1653880068689.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @DeEviloN ,

 

Please check you data model. Here I create a sample to have a test.

Summary 21:

RicoZhou_0-1653880001634.png

calendar:

calendar =
ADDCOLUMNS (
    CALENDARAUTO (),
    "Year", YEAR ( [Date] ),
    "Qtr",
        "Qtr" & " "
            & QUARTER ( [Date] )
)

Relationship:

RicoZhou_1-1653880042959.png

You can try this measure to get result.

Diff between Current Qtr and Last Qtr = 
VAR _SUMMARIZE =
    SUMMARIZE (
        'calendar',
        'calendar'[Qtr],
        "DIFF",
            VAR _DIFF =
                TOTALQTD ( SUM ( 'Summary 21'[Number of items total,pcs] ), 'Summary 21'[Date] )
                    - CALCULATE (
                        TOTALQTD ( SUM ( 'Summary 21'[Number of items total,pcs] ), 'Summary 21'[Date] ),
                        DATEADD ( 'calendar'[Date], -1, QUARTER )
                    )
            RETURN
                IF ( 'calendar'[Qtr] = "Qtr 1", 0, _DIFF )
    )
RETURN
    SUMX ( _SUMMARIZE, [DIFF] )

Result is as below.

RicoZhou_2-1653880068689.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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