The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
desired output
Month Total 2023 Total 2024 LFL 2023 LFL 2024
Jan | 20 | 35 | 20 | 27 |
Feb | 21 | 31 | 21 | 22 |
Mar | 20 | 37 | 20 | 28 |
Apr | 32 | 33 | 12 | 33 |
data
Month Store 2023 Sales 2024 Sales
Jan | S23 | 10 | 12 |
Jan | S24 | 10 | 15 |
Jan | S25 | (blank) | 8 |
Feb | S23 | 12 | 11 |
Feb | S24 | 9 | 11 |
Feb | S25 | (blank) | 9 |
Mar | S23 | (blank) | 9 |
Mar | S24 | 15 | 18 |
Mar | S25 | 5 | 10 |
Apr | S23 | 20 | (blank) |
Apr | S24 | 2 | 21 |
Apr | S25 | 10 | 12 |
Why have you posted this question multiple times. See my response here - context change - Microsoft Fabric Community
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)
(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] ) )
)
)
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
Month Total 2023 Total 2024 LFL 2023 LFL 2024
Jan | 20 | 35 | 20 | 27 |
Feb | 21 | 31 | 21 | 22 |
Mar | 20 | 37 | 20 | 28 |
Apr | 32 | 33 | 12 | 33 |
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.
User | Count |
---|---|
69 | |
64 | |
62 | |
55 | |
28 |
User | Count |
---|---|
112 | |
81 | |
65 | |
48 | |
38 |