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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply

aggregation at customer name level

desired output 

Month Total 2023 Total 2024 LFL 2023 LFL 2024

Jan20352027
Feb21312122
Mar20372028
Apr32331233

Goal:

  1. Total 2023: Sum the sales for 2023 for each month.
  2. Total 2024: Sum the sales for 2024 for each month.
  3. LFL 2023: For each month, calculate the total 2023 sales only for stores that have sales in both 2023 and 2024 for that same month.
  4. LFL 2024: For each month, calculate the total 2024 sales only for stores that have sales in both 2023 and 2024 for that same month.


data

Month Store 2023 Sales 2024 Sales

JanS231012
JanS241015
JanS25(blank)8
FebS231211
FebS24911
FebS25(blank)9
MarS23(blank)9
MarS241518
MarS25510
AprS2320(blank)
AprS24221
AprS251012
4 REPLIES 4
Ashish_Mathur
Super User
Super User

Why have you posted this question multiple times.  See my response here - context change - Microsoft Fabric Community


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @Hemant_Jaiswar ,

 

I want to acknowledge valuable input provided by Kedar_Pande  . Their initial ideas help guide my approach. However, I noticed that more details are needed to fully understand this issue.

(1) Create a column.

Flag = IF([2023 Sales]<>BLANK() && [2024 Sales]<> BLANK(),1,0) 

vtangjiemsft_0-1735783186003.png

(2) Then create a new table.

Table 2 = 
ADDCOLUMNS (
    VALUES ( 'Table'[Month] ),
    "Total 2023",
        CALCULATE (
            SUM ( 'Table'[2023 Sales] ),
            FILTER ( 'Table', 'Table'[Month] = EARLIER ( 'Table'[Month] ) )
        ),
    "Total 2024",
        CALCULATE (
            SUM ( 'Table'[2024 Sales] ),
            FILTER ( 'Table', 'Table'[Month] = EARLIER ( 'Table'[Month] ) )
        ),
    "LFL 2023",
        CALCULATE (
            SUM ( 'Table'[2023 Sales] ),
            FILTER ( 'Table', [Flag] = 1 && 'Table'[Month] = EARLIER ( 'Table'[Month] ) )
        ),
    "LFL 2024",
        CALCULATE (
            SUM ( 'Table'[2024 Sales] ),
            FILTER ( 'Table', [Flag] = 1 && 'Table'[Month] = EARLIER ( 'Table'[Month] ) )
        )
)

vtangjiemsft_1-1735783334633.png

Best Regards,

Neeko Tang

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

no 

  • LFL 2023: For each month, calculate the total 2023 sales only for stores that have sales in both 2023 and 2024 for that same month.
  • LFL 2024: For each month, calculate the total 2024 sales only for stores that have sales in both 2023 and 2024 for that same month.
    and in my output there is only month dimension

    Month Total 2023 Total 2024 LFL 2023 LFL 2024

    Jan20352027
    Feb21312122
    Mar20372028
    Apr32331233

 

Kedar_Pande
Super User
Super User

@Hemant_Jaiswar 

Use the following DAX measures:

Total 2023 = SUM('Table'[2023 Sales])

Total 2024 = SUM('Table'[2024 Sales])
LFL 2023 = 
CALCULATE(
SUM('Table'[2023 Sales]),
FILTER(
'Table',
NOT(ISBLANK('Table'[2023 Sales])) &&
NOT(ISBLANK('Table'[2024 Sales]))
)
)
LFL 2024 = 
CALCULATE(
SUM('Table'[2024 Sales]),
FILTER(
'Table',
NOT(ISBLANK('Table'[2023 Sales])) &&
NOT(ISBLANK('Table'[2024 Sales]))
)
)

Create a table visual with Month as rows and the four measures as columns.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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