Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
lost_flower
Helper III
Helper III

Don't count before starting date

Hello,

 

I try to count my lost customers and my visual looks like

 

lost_flower_0-1677227070419.png

 

where Lost = IF([Netamount_mon])=BLANK(),1,0) and year and month come from a date table.

Since customer A first purchased date is Oct 2021, it should not count as lost.

 

I tried IF('Date'[Date] < [first purchased date], BLANK(),...), but the date table does not work with IF function.

 

Happy for any idea.

 

Thanks a lot

 

1 ACCEPTED SOLUTION
andhiii079845
Super User
Super User

Works fine in may case: (right the table via dimDate)

andhiii079845_0-1677230956074.png

andhiii079845_2-1677231057024.png

 

 

andhiii079845_1-1677231030769.png

Can you post your data model please? 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
andhiii079845
Super User
Super User

Works fine in may case: (right the table via dimDate)

andhiii079845_0-1677230956074.png

andhiii079845_2-1677231057024.png

 

 

andhiii079845_1-1677231030769.png

Can you post your data model please? 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




aaaahhhh, my relationship was not correct. Thank so much. Now it works. 😇😇😇😇😇😇😇😇😇

lost_flower
Helper III
Helper III

Thanks for your help. When I try your DAX I receive the same error 😞

 

lost_flower_0-1677229543348.png

My Date comes from a different Date Table. This is exactly where I struggle

I should mention that I tried it as a measure

You have to use the by VAR firstime the date column from "6_lost"
VAR currenttime you have to use the date column from "6_lost"





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




andhiii079845
Super User
Super User

My solution: Tabelle2

andhiii079845_1-1677229066306.png

Via DAX, your old value:

Lost = IF(sum(Tabelle2[Amount])>0,0,1)
New DAX:
Lost_new = 
 VAR firsttime = CALCULATE(min(Tabelle2[Date]),FILTER(ALL(Tabelle2),Tabelle2[Amount]>0))
 VAR currenttime = MAXX(Tabelle2,Tabelle2[Date])
VAR varnew = IF(sum(Tabelle2[Amount])= 0 && currenttime>firsttime,1,0)
RETURN varnew
 
Result:
andhiii079845_2-1677229167162.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors