Forum Discussion
How would I do a dynamic visualization to show for Current and Next 12 Months Total Sales.
- Anonymous4 years ago
Hi mick22 ,
Here are the steps you can follow:
1. Create calculated table2.
Table2:
Table 2 =
CALENDAR(MIN('Table'[StartDate]),MAX('Table'[EndDate]))
Create the calculated column in Table2:
Year1 = VALUE( FORMAT('Table 2'[Date],"yyyymm"))Year2 = VALUE( FORMAT('Table 2'[Date],"yyyymm"))2. Create calculated table3.
Table3:
Table 3 = DISTINCT('Table 2'[Year2])3. Create measure.
Flag = var _1=CALCULATE(SUM('Table'[CurrentMonthlyPrice]),FILTER(ALL('Table 2'),'Table 2'[Year1]>=VALUE( FORMAT(MAX('Table'[StartDate]),"yyyymm"))&&MAX('Table 3'[Year2])<=VALUE( FORMAT(MAX('Table'[EndDate]),"yyyymm")))) return IF( MAX('Table 3'[Year2])<=MAX('Table 2'[Year1]),_1 ,0)Total_Incorrect = var _table=SUMMARIZE('Table 2','Table 2'[Year1],"_value",[Flag]) return IF(HASONEVALUE('Table 2'[Year1]),[Flag],SUMX(_table,[_value]))4. Result:
Refer to:
https://community.powerbi.com/t5/Desktop/Create-Lower-Triangular-Matrix/m-p/854339
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
My Data table has a start and an end date. I have carried out some transformations on that table to get a single column dates. Please study the steps in the Query Editor.
I made some progress and things look good in Power Query Editor after reviewing your steps! Thank you. I do have a question though... I'm not getting month names across the top.
- Ashish_Mathur4 years agoSuper User
You are welcome. In the Column labels, you should drag Year and Month name from the Calendar_dup table.
If my previous reply helped, please mark that reply as Answer.
- mick224 years agoFrequent Visitor
I did that previously but they still didn't come through.
- Ashish_Mathur4 years agoSuper User
I cannot help unless i see your file.