Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
93 | |
77 | |
65 | |
53 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |