Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe'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 am trying to write a DAX measure to count the no. of projects where the NET total spend this year is ZERO.
It mostly works but I have projects where they spend say $100 in February 2020, then -$100 in Nov 2020 - leading to a net total spend of ZERO - however, my DAX counts this project as a project that has non-zero spend.
In the table below - the no. of projects with zero net spend in 2020 should be two projects i.e. AAA and CCC
But my measure counts one project i.e. CCC
Here are my two measures - the second measure allows me to calculate 2020 spend.
| Project ID | Date | Value ($) |
| AAA | 1/1/2020 | -100 |
| AAA | 1/3/2020 | 50 |
| AAA | 1/4/2020 | 50 |
| BBB | 1/1/2020 | 50 |
| CCC | 1/1/2020 | 0 |
CCC | 1/2/2020 | 0 |
@Anonymous , Try a measure like
countx(filter(summarize('Table', 'Table'[Project ID], "_1",[CY20 Spend]+0),[_1]=0),[Project ID])
I assumed your measure CY20 Spend working correctly
or try measure like with date table
example
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
@Anonymous
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 |
|---|---|
| 9 | |
| 8 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 23 | |
| 14 | |
| 10 | |
| 6 | |
| 5 |