Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Lets say my date column has the value of '2018-12-27'. How can I get my measure (not column) to equal exacly '2018-12-27'. Or how can I get my measure to equal just the year '2018'.
Solved! Go to Solution.
@ajohn1 how about calculate number of days by doing a countdistinct on number of dates in the date table for a year
for example
Customer Count =
var numdays = CALCULATE(distinctcount([date]), allexcept(query1,year(query1[targetdate]))
return sum(Query1[Customer Served])/ numdays
Calculated column Total_Days_in_Year = Date(year(Query1[TargetDate]),12,31)-DATE(year(Query1[TargetDate]),1,1)+1. Total_Days_in_Year can either be 365 or 366(leap year). This returns the right value.
I have a calculated measure ‘Customer Count = sum(Query1[Customer Served]) / ( ??? *4)’. I would like to replace ??? with Total_Days_in_Year. Power BI will only let me use Total_Days_in_Year if it is aggregated.
So what can I do here?
@ajohn1 how about calculate number of days by doing a countdistinct on number of dates in the date table for a year
for example
Customer Count =
var numdays = CALCULATE(distinctcount([date]), allexcept(query1,year(query1[targetdate]))
return sum(Query1[Customer Served])/ numdays
Thans so much it worked. Where can I go to learn more things like this?
@ajohn1 i am still learning a lot of this stuff and I am doing it by solving problems on the forum.
also could you mark the correct solution as the accepted one?
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 |
|---|---|
| 50 | |
| 44 | |
| 42 | |
| 19 | |
| 19 |
| User | Count |
|---|---|
| 69 | |
| 68 | |
| 33 | |
| 32 | |
| 32 |