Forum Discussion

skashifz's avatar
skashifz
Frequent Visitor
5 years ago
Solved

Need to change this DAX table

Hi guys, I am very new to Power Bi. So appologies for any mistake or shortcoming in my question. (Sample pbix file https://www.dropbox.com/s/258z1bv2fnzrq47/AdventureWorksDW1.pbix?dl=0 )   ...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi skashifz 

    I think you want to build a line chart to show SalesAmounts in previous 14 dates. Try to build an unrelated calendar table and build a measure to filter your visual.

    Calendar = 
    SUMMARIZE(ALL(DimDate),DimDate[DateKey],DimDate[FullDateAlternateKey])

    Measure:

    Measure = 
    VAR _SelectDate = SELECTEDVALUE('Calendar'[FullDateAlternateKey])
    RETURN
    IF(MAX(DimDate[FullDateAlternateKey])>=_SelectDate-14&&MAX(DimDate[FullDateAlternateKey])<_SelectDate,1,0)

    Add this visual into filter field in line visual and set it to show items when value = 1. Result is as below. When I select 20140128, we will get result from 20140114 to 20140127.

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.