Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Thanks for looking at my post.
I have below data and looking for some formula to replicate "Final result" column please. Any idea will be appreciated.
I am looking for some DAX formula for counting number of "twos" per month and converting to percentage please.
In this instance, for the month of Jan it will be 3/13 will be 23.07%. for month of Feb it will be 0% as there is no twos in that month. For month of March it will 7/10 and answer will be 70%.
Note : Date column wont be in order and it will be mixed with several dates. I have put it in ascending for better understanding.
Any idea will be much appreciated
Thanks a lot
Solved! Go to Solution.
@ValtteriN Thanks for your contribution on this thread.
Hi @jimpatel ,
You can create a measure as below to get it, please find the details in the attachment.
Final result =
VAR _date =
SELECTEDVALUE ( 'Table'[Due Date] )
VAR _partmonth =
CALCULATE (
COUNT ( 'Table'[Due Date] ),
FILTER (
ALLSELECTED ( 'Table' ),
YEAR('Table'[Due Date])=YEAR(_date)
&& MONTH ( 'Table'[Due Date] ) = MONTH ( _date )
&& 'Table'[Time to Close] = 2
)
)
VAR _month =
CALCULATE (
COUNT ( 'Table'[Due Date] ),
FILTER (
ALLSELECTED ( 'Table' ),
YEAR('Table'[Due Date])=YEAR(_date)
&& MONTH ( 'Table'[Due Date] ) = MONTH ( _date )
)
)
RETURN
IF ( ISBLANK ( _partmonth ), 0, DIVIDE ( _partmonth, _month ) )
Best Regards
Hi @jimpatel ,
The dax I used should work also in column with small changes:
Could you describe what kind of issue you encountered with this approach?
Proud to be a Super User!
@ValtteriN Thanks for your contribution on this thread.
Hi @jimpatel ,
You can create a measure as below to get it, please find the details in the attachment.
Final result =
VAR _date =
SELECTEDVALUE ( 'Table'[Due Date] )
VAR _partmonth =
CALCULATE (
COUNT ( 'Table'[Due Date] ),
FILTER (
ALLSELECTED ( 'Table' ),
YEAR('Table'[Due Date])=YEAR(_date)
&& MONTH ( 'Table'[Due Date] ) = MONTH ( _date )
&& 'Table'[Time to Close] = 2
)
)
VAR _month =
CALCULATE (
COUNT ( 'Table'[Due Date] ),
FILTER (
ALLSELECTED ( 'Table' ),
YEAR('Table'[Due Date])=YEAR(_date)
&& MONTH ( 'Table'[Due Date] ) = MONTH ( _date )
)
)
RETURN
IF ( ISBLANK ( _partmonth ), 0, DIVIDE ( _partmonth, _month ) )
Best Regards
Thanks a lot for your input.
Any help in getting this for 6 months rolling please?
Thanks a lot
Thanks a lot for your kind help.
It works well and thanks a lot for that.
One last question, how can i get last 6 months (rolling) in this formula please?
Thanks a lot again
Great!
Thanks a lot for your reply. Is it possible to use DAX column formula instead of measure pleasE?
Thanks a lot
Hi @jimpatel ,
The dax I used should work also in column with small changes:
Could you describe what kind of issue you encountered with this approach?
Proud to be a Super User!
Hi,
Here is one way to do this:
Data:
Relation:
Dax:
Note That the table in visual is using 'calendar'[date]
Proud to be a Super User!
Thanks a lot for your reply. For some reason the answer i am getting is wrong. Do i need to tweak anything in the formula please?
thanks a lot again
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Ask questions in Eventhouse and KQL, Eventstream, and Reflex.
User | Count |
---|---|
72 | |
35 | |
21 | |
18 | |
15 |
User | Count |
---|---|
127 | |
31 | |
27 | |
24 | |
22 |