Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
I have one table and I have a condition to calculate
Note: I built a calendar table where the start date is equal to order date and the last date is the maximum shipped date
please if anyone could help
Solved! Go to Solution.
Hi @alialsayer
if
use measure like bellow:
measure1 =
VAR _seldate=SELECTEDVALUE('calendar'[Date])
RETURN
CALCULATE(Sum('Table'[US]), FILTER('Table',('Table'[Order Date] >=_seldate || 'Table'[Shipped Date] >=_seldate ) && 'Table'[Deliver] = "Yes"))
if
then
measure1 =
VAR _seldate=SELECTEDVALUE('calendar'[Date])
RETURN
CALCULATE(Sum('Table'[US]), FILTER('Table',('Table'[Order Date] >=_seldate && 'Table'[Shipped Date] >=_seldate ) && 'Table'[Deliver] = "Yes"))
-
measure2 =
VAR _seldate=SELECTEDVALUE('calendar'[Date])
RETURN
CALCULATE(Sum('Table'[US]), FILTER('Table','Table'[Shipped Date] >=_seldate && 'Table'[Deliver] = "Yes"))
-
result:
Best Regards,
Community Support Team _ Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Hi @alialsayer
if
use measure like bellow:
measure1 =
VAR _seldate=SELECTEDVALUE('calendar'[Date])
RETURN
CALCULATE(Sum('Table'[US]), FILTER('Table',('Table'[Order Date] >=_seldate || 'Table'[Shipped Date] >=_seldate ) && 'Table'[Deliver] = "Yes"))
if
then
measure1 =
VAR _seldate=SELECTEDVALUE('calendar'[Date])
RETURN
CALCULATE(Sum('Table'[US]), FILTER('Table',('Table'[Order Date] >=_seldate && 'Table'[Shipped Date] >=_seldate ) && 'Table'[Deliver] = "Yes"))
-
measure2 =
VAR _seldate=SELECTEDVALUE('calendar'[Date])
RETURN
CALCULATE(Sum('Table'[US]), FILTER('Table','Table'[Shipped Date] >=_seldate && 'Table'[Deliver] = "Yes"))
-
result:
Best Regards,
Community Support Team _ Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Thanks, it works with me, I really appreciate your help and your attached example make this easy to understand 🌹
@alialsayer , with help from independent date table
measure 1=
VAR minDate = MINX( allselected('Calendar') , 'Calendar'[Date] )
VAR maxDate = MAXX(allselected('Calendar') , 'Calendar'[Date] )
RETURN
CALCULATE(Sum(Table[US$]), filter( Table,Table[Order Date] >=_min && Table[Shipped Date] >=_max && Tbale[delivered] = "Yes"))
measure 2 =
VAR minDate = MINX( allselected('Calendar') , 'Calendar'[Date] )
VAR maxDate = MAXX(allselected('Calendar') , 'Calendar'[Date] )
RETURN
CALCULATE(Sum(Table[US$]), filter( Table, Table[Shipped Date] >=_max && Table[delivered] = "Yes"))
Thank you, I try these VAR measures but it doesn't work for me. It gives me wrong numbers
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 64 | |
| 53 | |
| 42 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 124 | |
| 105 | |
| 44 | |
| 32 | |
| 24 |