We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi
I have two tables one is a transaction and another one is a date table
The transaction table has two columns category, and amount. I have ten categories in the category table. I need to filter only three category. Date table has a date and year column.
I want to calculate the fiscal year (7/1/2017- 6/30/2018) using the DAX function.
Need output as below,
| Category | Fiscal Year amount |
| B | 15000 |
| C | 2000 |
| D | 9000 |
When I use Filter for category and Date, I am able to get the above results. However, when I use the below DAX function, I am getting a different value as well as unable to filter the categories.
Solved! Go to Solution.
Hi @bourne2000
Not clear about your data model and table structure, so I create a sample, it may give you pointers. See sample file attached below.
-
Create a measure,
Measure =
VAR _enddate=DATE(SELECTEDVALUE('Table'[fiscal year]),6,30)
var _firstdate = EDATE(_enddate,-12)
return
CALCULATE(SUM(TRANSACTIONS[AMOUNT]),FILTER(TRANSACTIONS,TRANSACTIONS[DATE]<=_enddate&&TRANSACTIONS[DATE]>_firstdate))
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 @bourne2000
Not clear about your data model and table structure, so I create a sample, it may give you pointers. See sample file attached below.
-
Create a measure,
Measure =
VAR _enddate=DATE(SELECTEDVALUE('Table'[fiscal year]),6,30)
var _firstdate = EDATE(_enddate,-12)
return
CALCULATE(SUM(TRANSACTIONS[AMOUNT]),FILTER(TRANSACTIONS,TRANSACTIONS[DATE]<=_enddate&&TRANSACTIONS[DATE]>_firstdate))
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.
@bourne2000 , This seems correct.
fiscial year= TOTALYTD(SUM(TRANSACTIONS[AMOUNT]), DATE[DATE], "6/30")
You will have YTD for each category. I think YTD will not sum up across category
@amitchandak Fiscal year values are not matching when I use the Dax function. It's correct when I use date slicer.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 57 | |
| 38 | |
| 32 | |
| 18 | |
| 16 |
| User | Count |
|---|---|
| 66 | |
| 66 | |
| 40 | |
| 34 | |
| 25 |