Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi All
I have below raw data , I like to compute YTD COGS amount.
My PBI File :-
https://www.dropbox.com/s/v578c2yp58eh70z/HOW%20TO%20COMPUTE%20REVENUE%20YTD%20V0002.pbix?dl=0
Hi @Paulyeo11 ,
There are two ways to achieve:
1. Create a measure.
COGS_YTD_First =
CALCULATE (
SUMX ( FILTER ( 'Table', 'Table'[PNL] = "COGS" ), 'Table'[AMOUNT] ),
DATESYTD ( 'Date'[Date] ),
'Table'[DATE]<=NOW(),
'Table'[Year]=2020
)
2. Create two measure.
IF =
IF(MAX('Table (2)'[PNL])="COGS",
CALCULATE(SUM('Table (2)'[AMOUNT]),FILTER('Table (2)','Table (2)'[DATE]>=CALCULATE(MIN('Table (2)'[DATE]),ALL('Table (2)'[DATE])) && 'Table (2)'[DATE]<=NOW() && 'Table (2)'[Year]=2020 )),
BLANK()
)
COGS_YTD_Second =
var _new=SUMMARIZE('Table (2)','Table (2)'[DATE],"_value",[IF])
return IF(HASONEVALUE('Table (2)'[DATE]),[IF],SUMX(_new,[_value]))
)
3. Result.
You can downloaded PBIX file from here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Does this work for you?
COGS YTD =
CALCULATE (
SUMX ( FILTER ( 'Table', 'Table'[PNL] = "COGS" ), 'Table'[AMOUNT] ),
DATESYTD ( 'Date'[Date] )
)
Hi Sir
Thank you for your sharing. I have test your script , no error , but it include Nov 2020 year. since YTD is up to Oct only.
My PBI file :-
https://www.dropbox.com/s/24fhwftffdluka9/HOW%20TO%20COMPUTE%20REVENUE%20YTD%20V0003.pbix?dl=0
Hi,
You may download my PBI file from here.
Hope this helps.
Hi Ashish
Thank you very much for your sharing.
your script pls helpp me exclude Dec 2019 amount.
You are welcome. Filter it out (Filter pane)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
96 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
88 | |
63 |