The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Please help
I want to calculate opening balance based on released date and completion date
For any date, i want to calculaten opening balance based on below conditions:
https://drive.google.com/drive/folders/1Fgnvl17hLfMKefH338isn3ukaHnmg_qU?usp=sharing
OPENING BAL = RELEASED DATE < REPORT DATE |
AND RELEASED DATE <> BLANK() |
AND |
COMPLETION DATE >= REPORT DATE |
OR COMPLETION DATE = BLANK() |
Solved! Go to Solution.
Try this as a measure on a table with CALENDAR[Date]:
Opening Balance =
VAR ReportDate = SELECTEDVALUE ( 'CALENDAR'[Date] )
RETURN
SUMX (
FILTER (
CALCULATETABLE ( DATA, REMOVEFILTERS ( 'CALENDAR' ) ),
( DATA[RELEASED DATE] < ReportDate && NOT ( ISBLANK ( DATA[RELEASED DATE] ) ) ) &&
( DATA[COMPLETION DATE] >= ReportDate || ISBLANK ( DATA[COMPLETION DATE] ) )
),
DATA[QUANTITY]
)
@Anonymous try this
measure =
CALCULATE (
SUM ( tbl[Quantity] ),
FILTER ( tbl, tbl[ReleaseDate] < TODAY () || tbl[ReleaseDate] <> BLANK () )
)
+ CALCULATE (
SUM ( tbl[Quantity] ),
FILTER (
tbl,
tbl[CompletionDate] > TODAY ()
|| tbl[CompletionDate] <> BLANK ()
)
)
@smpa01 Can you please check below link, both sample data and output added
https://drive.google.com/drive/folders/1Fgnvl17hLfMKefH338isn3ukaHnmg_qU?usp=sharing
@smpa01 I think your first || should be &&, your last <> should be =, and I don't think you want to separate this into two sums.
@Anonymous I think this might be a bit closer:
Opening Balance =
VAR ReportDate = TODAY () /* Or however this is determined*/
RETURN
SUMX (
FILTER (
Table1,
( Table1[ReleaseDate] < ReportDate && NOT ( ISBLANK ( Table1[ReleaseDate] ) ) ) &&
( Table1[CompletionDate] >= ReportDate || ISBLANK ( Table1[CompletionDate] ) )
),
Table1[Quantity]
)
Can you please check below link, both sample data and output added
https://drive.google.com/drive/folders/1Fgnvl17hLfMKefH338isn3ukaHnmg_qU?usp=sharing
Try this as a measure on a table with CALENDAR[Date]:
Opening Balance =
VAR ReportDate = SELECTEDVALUE ( 'CALENDAR'[Date] )
RETURN
SUMX (
FILTER (
CALCULATETABLE ( DATA, REMOVEFILTERS ( 'CALENDAR' ) ),
( DATA[RELEASED DATE] < ReportDate && NOT ( ISBLANK ( DATA[RELEASED DATE] ) ) ) &&
( DATA[COMPLETION DATE] >= ReportDate || ISBLANK ( DATA[COMPLETION DATE] ) )
),
DATA[QUANTITY]
)
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
79 | |
78 | |
47 | |
39 |
User | Count |
---|---|
147 | |
115 | |
65 | |
64 | |
53 |