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.
Hello,
I don't understand why i have an error message when i try to use a variable in text.
Test Montant CDE Cumulé = TOTALYTD(sum(Commande[CDE €]);'Date'[Date];"31/"+Month(TODAY())-1)
Can you help me please.
Hi @AlexGallet01,
Could you specdify your scenario and show the error message?
In addition, you could have a look at the syntax of VAR function and how to use it.
Best Regards,
Cherry
Hi @v-piga-msft,
I want to use this unction for calculate a percentage but for that i need to insert into this calculate just the months who are finished. So i want to delete the month of the day for have a just calculate.
My error message is on the true / false exception or i don't use this functionnality in my function.
I try to use the Var function and when i use it i have the same error of last.
Test Montant CDE Cumulé = var moisencours = MONTH(TODAY())-1 return TOTALYTD(sum(Commande[CDE €]);'Date'[Date];"31/"&moisencours)
Best regards
Hi @AlexGallet01,
By my test, we may not write the dax TOTALYTD like "31/"&moisencours, there is syntax error. The year-end date should be a literal string with a date.
There is another way to achieve your desired output.
Assuming you have a calender table then you need to create a calculated column.
monthday = DATE(YEAR('Table'[Date]),MONTH(TODAY())-1,31)
Then you could modify your measure like below and create another measure to achieve the ytd to "31/month(today())-1".
Measure = TOTALYTD(SUM(Table1[Sales]),'Table'[Date],ALL('Table'[Date])) Measure 2 = IF(MAX('Table'[Date])<=MAX('Table'[monthday]),[Measure],BLANK())
Here is the test result.
For more details, you could have a reference of the file attached below.
Best Regards,
Cherry
User | Count |
---|---|
77 | |
77 | |
68 | |
67 | |
49 |
User | Count |
---|---|
108 | |
105 | |
93 | |
83 | |
64 |