Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
HI
I would like to to get the sum of PROFITABLE_OUTLETS with comparing "DATE_MOC" and "ECO_MOC_DATE" dates fields .
Below formula used in Tableau.
PO= SUM(IF (YEAR([Date_Moc]) = YEAR([ ECO_MOC_Date])
and MONTH([Date_Moc]) = MONTH([ ECO_MOC_Date]))
THEN [PROFITABLE_OUTLETS] ELSE 0 END)
If i implement same logic in powerbi , not getting "ECO_MOC_1" field in year and month section.
PO =
VAR PO=
CALCULATE(SUM([PROFITABLE_OUTLETS]),
AND(
MONTH([Date_Moc])=MONTH(XXXXX),
YEAR([Date_Moc])=YEAR(XXXXX)))
RETURN IF(ISBLANK(PO),0,PO)
Please let me know how to get this
Thanks in advance
Solved! Go to Solution.
Hi @harib
If you need a new column, you could try:
PO Column =
IF (
YEAR ( 'Table'[Date_Moc] ) = YEAR ( 'Table'[ECO_MOC_Date] )
&& MONTH ( 'Table'[Date_Moc] ) = MONTH ( 'Table'[ECO_MOC_Date] ),
'Table'[PROFITABLE_OUTLETS],
0
)
If you need a measure, you could try:
PO Measure =
IF (
MONTH ( SELECTEDVALUE ( 'Table'[Date_Moc] ) )
= MONTH ( SELECTEDVALUE ( 'Table'[ECO_MOC_Date] ) )
&& YEAR ( SELECTEDVALUE ( 'Table'[Date_Moc] ) )
= YEAR ( SELECTEDVALUE ( 'Table'[ECO_MOC_Date] ) ),
SUM ( 'Table'[PROFITABLE_OUTLETS] ),
0
)
Is this what you want?
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.
Hi @harib
If you need a new column, you could try:
PO Column =
IF (
YEAR ( 'Table'[Date_Moc] ) = YEAR ( 'Table'[ECO_MOC_Date] )
&& MONTH ( 'Table'[Date_Moc] ) = MONTH ( 'Table'[ECO_MOC_Date] ),
'Table'[PROFITABLE_OUTLETS],
0
)
If you need a measure, you could try:
PO Measure =
IF (
MONTH ( SELECTEDVALUE ( 'Table'[Date_Moc] ) )
= MONTH ( SELECTEDVALUE ( 'Table'[ECO_MOC_Date] ) )
&& YEAR ( SELECTEDVALUE ( 'Table'[Date_Moc] ) )
= YEAR ( SELECTEDVALUE ( 'Table'[ECO_MOC_Date] ) ),
SUM ( 'Table'[PROFITABLE_OUTLETS] ),
0
)
Is this what you want?
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
68 | |
64 | |
52 | |
39 | |
26 |
User | Count |
---|---|
80 | |
57 | |
45 | |
44 | |
35 |