Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Multiple taxonomy in same table

Dear friends,

 

I am trying to find a solution to my report. The report fetches the data from a Wordpress database, where the posts are assigned to taxonomy (category, tag, series) in a separate table. So in the relationship table against a postid, the associated taxonomy ids are linked.

A post (id) can be associated to one or more category, series and tag (ids)

e.g table below

TitleTaxonomyValue
Ram meets SitacategoryMythology
Ram meets SitaSeriesRamayana
Shivaji kills AzalcategoryHistorical
Shivaji kills AzalSeriesMaratha Kings
Theogony: Clash of the TitanscategoryMythology
Theogony: Clash of the TitansSeriesTheogony
Jalianwalah Bagh massacrecategoryHistorical
Jalianwalah Bagh massacreSeriesIndependence

 

Currently I am able to get only one taxonomy against the post in the basic table. I am trying to create a basic report that has the following structure and do the filtering.

 

TitleCategorySeries
Ram meets SitaMythologyRamayana
Shivaji kills AzalHistoricalMaratha Kings
Theogony: Clash of the TitansMythologyTheogony
Jalianwalah Bagh massacreHistoricalIndependence

 

Can someone help me in getting both category and series of a post in the single table?

  • Hi,

    This M code works

    let
        Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
        #"Pivoted Column" = Table.Pivot(Source, List.Distinct(Source[Taxonomy]), "Taxonomy", "Value")
    in
        #"Pivoted Column"

    Hope this helps.

     

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi  Anonymous ,

     

    Here are the steps you can follow:

    1. Create calculated table.

    Table =
        SUMMARIZE('Table1','Table1'[Title],
        "category",CALCULATE(MAX('Table1'[Value]),TREATAS({"category"},'Table1'[Taxonomy])),
        "Series",CALCULATE(MAX('Table1'[Value]),TREATAS({"Series"},'Table1'[Taxonomy])))

    2. Result:

     

    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

2 Replies

  • Hi,

    This M code works

    let
        Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
        #"Pivoted Column" = Table.Pivot(Source, List.Distinct(Source[Taxonomy]), "Taxonomy", "Value")
    in
        #"Pivoted Column"

    Hope this helps.

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Anonymous ,

     

    Here are the steps you can follow:

    1. Create calculated table.

    Table =
        SUMMARIZE('Table1','Table1'[Title],
        "category",CALCULATE(MAX('Table1'[Value]),TREATAS({"category"},'Table1'[Taxonomy])),
        "Series",CALCULATE(MAX('Table1'[Value]),TREATAS({"Series"},'Table1'[Taxonomy])))

    2. Result:

     

    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