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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

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

alanpjames_0-1654010942468.png

 

 



alanpjames_1-1654010942693.png

 

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

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 
Please try something like

Measure1 =
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] )
    )

View solution in original post

13 REPLIES 13
tamerj1
Super User
Super User

Hi @Anonymous 
Please try something like

Measure1 =
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] )
    )
Anonymous
Not applicable

Hai @tamerj1 
This solution is not working , can i create two table for version?

@Anonymous 
I don't know how your data and data model look like.

Anonymous
Not applicable

Hai @tamerj1 

 

alanpjames_0-1654109302441.png
This is the data model master table contains all dimension values and the sales table is a fact table

alanpjames_1-1654109325665.png

This is the fact table here I will append every version of data in this particular table, I have a data of V5- May -2021 to v4- April-2022

alanpjames_2-1654109325479.png

After I had created a version flag so based on this report will understand the max of version

alanpjames_3-1654109325493.png

And user want to see the report based on the latest version of data and they want to compare it with previous ones
Requirment is , After appedning every version table instead of write a static latest version(like which i marked in red)
I want to add dynamic latest version. And report should automatically  update with latest version.Even the new version of table appending
Hope it clear please reach out still you have any doubt

 

Good morning @Anonymous 

this is exactly what I was trying to do. Her is the explanation of my idea and let me know if anything does not seem right. 
The latest verion corresponds to the latest date available in the MASTER table. I started with calculating the last date avialable in the master table by removing all filters. 
using this date I calculated the corresponding version and again by removing all filters. 
this should give me the last version which I can refer to in your measure. Not sure wht goes wrong? Please correct me if I missed something. 

Anonymous
Not applicable

Hai @tamerj1  
Can you suggest some other way based on version
and 
please guide this i am trying to solve through this

alanpjames_0-1654137703844.png

I am trying to create a calculated column based max of forecast version column based on max version flag. but this is showing wrong 
version flag represnts number of  each version 

Hi @Anonymous 

can we connected on zoom or teams now? I can share a link in private message 

Anonymous
Not applicable

.

I shareda link

Anonymous
Not applicable

Hai @tamerj1 can you please help me to acheive this logic

Anonymous
Not applicable

Hai @tamerj1 
Can you check this measure

alanpjames_0-1654095679232.png

 

@Anonymous 

Try delete FILTER (

lbendlin
Super User
Super 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

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.