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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

DAX Sum function with Where condition

Hi,

 

I need help in creating the DAX formula, one created is not working correctly

 

this is SQL query 

SELECT
CreatedMonth,
Product,
SUM(Value)
FROM Table1

WHERE
CreatedMonth = ReportingMonth

GROUP BY
CreatedMonth
Product
ORDER BY CreatedMonth

 

SQL query result

 

CreatedMonthProductSum_Value
FP2021.08XYZ1219
FP2021.09XYZ811
FP2021.10XYZ286
FP2021.11XYZ280
FP2021.12XYZ543
FP2022.01XYZ1412
FP2022.02XYZ561
FP2022.03XYZ586
FP2022.04XYZ300
FP2022.05XYZ304
FP2022.06XYZ382

 

But when created DAX formula

Sum_Created = CALCULATE(Sum(Table1[Value]),Table1[CreatedMonth] = Table1[ReportingMonth])

 

Getting the result from PBI, giving entire total for each month. also,I added reportingmonth to the table even then no change

VijiRGBS_0-1696941017841.png

 

1 ACCEPTED SOLUTION
mh2587
Super User
Super User

Sum_Created = //try this one might help you
SUMX(
    FILTER(
        Table1,
        Table1[CreatedMonth] = Table1[ReportingMonth]
    ),
    Table1[Value]
)

Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



View solution in original post

2 REPLIES 2
Anonymous
Not applicable

thank you so much for quick reply, it worked!!

mh2587
Super User
Super User

Sum_Created = //try this one might help you
SUMX(
    FILTER(
        Table1,
        Table1[CreatedMonth] = Table1[ReportingMonth]
    ),
    Table1[Value]
)

Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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