Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Solved! Go to Solution.
Ive got it
Hola @DebbieE ,
En DAX, las variables se calculan dentro del ámbito en el que se escriben y, a continuación, el resultado de ellas se almacena y se utiliza en el resto de la expresión. Consulte más información: Precaución al usar variables en DAX y Power BI.
Puede cambiar la fórmula como DAX a continuación.
YTD Sales Var =
VAR TYTD = TOTALYTD(SUM(Table1[Sales]), DimDate[FullDateAlternateKey])
VAR LYTD = CALCULATE(SUM(Table1[Sales]) ,SAMEPERIODLASTYEAR(DimDate[FullDateAlternateKey]))
RETURN TYTD-LYTD
Como referencia:
https://community.powerbi.com/t5/Desktop/var-different-result/td-p/283143
https://community.powerbi.com/t5/Desktop/VAR-different-result-than-without-it/td-p/518723
Saludos
Amy
Equipo de apoyo a la comunidad _ Amy
Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
VAR LYTD = CALCULATE (SUM (Table1 [Sales]), SAMEPERIODLASTYEAR (DimDate [FullDateAlternateKey]))
But this isnt calculating the Year to date measure that Im basing last year on so this wouldnt work?
As in my TYTD variable
TOTALYTD (SELECTEDMEASURE (), DimDate [FullDateAlternateKey])
I should say, Im trying to do some work on calulated groups with Tabular Editor and Im trying to find ways of recreating my measures so they could be used for calculated groups and its proving really difficult
Ive got it
@DebbieE - Esto le puede resultar útil - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000
También, ver si mi Inteligencia del Tiempo el Camino Duro proporciona una manera diferente de lograr lo que está buscando.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.