Forum Discussion
Converting static to Dynamic Measure
Hai All,
I am expecting a super solution for this requirement.
The requirement is Currently I am working on a sales dashboard and every year this report is having different versions of tables for eg
V5-May-2021, V6-June-2021 To V1 Jan-2022, and it goes so every month user will share the new version of data with the same schema.
If the schema is following the same schema I am using the append option. But The problem is after appending every time with a new version I want to change my version static value with a new version name like this
so every time I want to change this measure manually with the new version
My requirement is instead of this static method how can I achieve this solution as dynamically
for eg (Instead of writing every time a new version name in this dax if I have another measure that contains an updated version so I can mention that here)
Note. this table has a column (version) and it consists of different versions of the table which appended
Hi Anonymous
Please try something likeMeasure1 = VAR LastDateWithData = CALCULATE ( MAX ( MASTER[Date] ), REMOVEFILTERS () ) VAR LastVerion = CALCULATE ( MAX ( MASTER[Version] ), MASTER[Date] = LastDateWithData, REMOVEFILTERS () ) RETURN CALCULATE ( SUM ( Sales[Values] ) / 1000, MASTER[Version] = LastVerion, ALL ( MASTER[Comparison] ) )
13 Replies
- lbendlinSuper User
You need to indicate to Power Query how the tables should be sorted. For example by extracting the date from the table name and then using the table with the latest date as the master.
Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. I cannot use screenshots of your source data.
Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523 - tamerj1Community Champion
Hi Anonymous
Please try something likeMeasure1 = VAR LastDateWithData = CALCULATE ( MAX ( MASTER[Date] ), REMOVEFILTERS () ) VAR LastVerion = CALCULATE ( MAX ( MASTER[Version] ), MASTER[Date] = LastDateWithData, REMOVEFILTERS () ) RETURN CALCULATE ( SUM ( Sales[Values] ) / 1000, MASTER[Version] = LastVerion, ALL ( MASTER[Comparison] ) )